티스토리 뷰

Programming/Nexacro

Nexacro - Grid 추가, 삭제, 저장

파란크리스마스 2017. 11. 25. 20:39
728x90

출처 : 농부지기 :: Nexacro.Dataset - 한줄 추가.삭제
농부지기 :: Nexacro.Grid - excel exort

화면배치

  • Button : id : BtnAdd / text : 추가
  • Button : id : BtnDel / text : 삭제
  • Button : id : BtnSave / text : 저장

Grid 컬럼 속성의 edit 속성 변경

Grid를 더블클릭해서 Grid 컬럼 설정 화면으로 이동

title 컬럼의 edittype : normal 로 변경

contents 컬럼의 edittype : normal 로 변경

추가버튼(BtnAdd) 구현

this.BtnAdd_onclick = function(obj:Button,  e:nexacro.ClickEventInfo)
{
	var nRow = this.Dataset00.addRow();
	trace("nRow===>> " + nRow + " :" + this.Dataset00.saveXML());
}

삭제버튼(BtnDel) 구현

this.BtnDel_onclick = function(obj:Button,  e:nexacro.ClickEventInfo)
{
	var nRow = this.Dataset00.rowposition;
	this.Dataset00.deleteRow(nRow);
}

저장버튼(BtnSave) 구현

this.BtnSave_onclick = function(obj:Button,  e:nexacro.ClickEventInfo)
{
	var sSvcID        	= "save";                    
    var sController   	= "egovSampleModifyVO.do";

    var sInDatasets   	= "input1=Dataset00:U";
	var sOutDatasets  	= "";
	var sArgs = "";	
	
	///////////////////////////////////////////////////////////////////////////////////////////////////
    // 2015.06.12 VO방식 테스트
    var sArgs="";
    sArgs += Ex.util.setParam("method","multiDataModifyService");
    sArgs += Ex.util.setParam("sqlId","sampleDAO.insertSampleVO");
    sArgs += Ex.util.setParam("inputClass","bizservice.nexa.sample.vo.SampleVO");
    sArgs += Ex.util.setParam("outputClass","bizservice.nexa.sample.vo.SampleVO");
    sArgs += Ex.util.setParam("forceSqlFlag","N");
    /////////////////////////////////////////////////////////////////////////////////////////////////
	
	//addInDataSet(this,  0, "ds_input","egovframework.rte.sample.service.XPSampleVO");
	//addOutDataSet(this, 0, "ds_output","egovframework.rte.sample.service.XPSampleVO");
	  
	Ex.core.tran(this,sSvcID, sController, sInDatasets, sOutDatasets, sArgs);
}

Spring Service 구현

package bizservice.nexa.sample.service;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Service;

import bizservice.nexa.sample.dao.SampleDAO;
import bizservice.nexa.sample.vo.SampleVO;

import com.nexacro.xapi.data.DataSet;

import egovframework.rte.cmmn.ria.nexacro.vo.RowType;
import egovframework.rte.fdl.cmmn.AbstractServiceImpl;
import egovframework.rte.fdl.idgnr.EgovIdGnrService;

@Service("sampleServiceXp")
public class EgovSampleServiceXpImpl extends AbstractServiceImpl implements EgovSampleServiceXp {
	protected Log logger = LogFactory.getLog(this.getClass());

	/** SampleDAO */
	@Resource(name = "sampleDAO")
	private SampleDAO sampleDAO;

	/** ID Generation */
	@Resource(name = "egovIdGnrService")
	private EgovIdGnrService egovIdGnrService;

	public List<?> sampleSelectVOList(SampleVO searchVO) throws Exception {
		// TODO Auto-generated method stub
		return sampleDAO.selectSampleVOList(searchVO);
	}

	/**
	 * 
	 * <PRE>
	 * 1. 메소드명 : saveData
	 * 2. 설    명 : DataSet의 rowType별로 Insert, Update, Delete가 수행되는 서비스이다.
	 * 3. 작 성 자 : 
	 * 4. 작 성 일 : 2016. 6. 11.
	 * </PRE>
	 * 
	 * @return ModelAndView
	 **/
	public void multiDataModifyService(
			List<Object> tranInfo, 
			Map<String, Object> inVar, 
			Map<String, List<Object>> inDataset, 
			Map<String, Object> outVar,
			Map<String, Object> outDataset) throws Exception 
	{
		// 서비스단 개발
		List<Object> list = inDataset.get("input1");

		for (int i = 0; i < list.size(); i++) {
			Object obj = list.get(i);
			if (obj instanceof RowType) {

				RowType rowType = (RowType) obj;
				if (rowType.getRowType() == DataSet.ROW_TYPE_INSERTED) {
					sampleDAO.insertSample(obj);
				} else if (rowType.getRowType() == DataSet.ROW_TYPE_UPDATED) {
					sampleDAO.updateSample(obj);
				} else if (rowType.getRowType() == DataSet.ROW_TYPE_DELETED) {
					sampleDAO.deleteSample(obj);
				}
			}
		}
	}
}
댓글
300x250
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/11   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
글 보관함