Categories | Question details Back To List | ||
I want to put certain cell types as ro and some as ed according to the parameter I got from the database I want to put certain cell types as ro and some as ed according to the parameter I got from the database if(positioncategory=="DSA"){ this.grid.setColTypes("ro,ro,ro,ro,ro,ro,ed,ro,ro,ro,ro,ed,ed,ro,link,ro"); }else{ this.grid.setColTypes("ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,link,ro"); } So if the position category is DSA i want one of the cell type as ed otherwise ro.How we can do that. Waiting for your reply. Thanks Eshika Answer posted by dhxSupport on Apr 20, 2009 05:57 Such logic is correct. You should call setColTypes method before init() method. Also this.grid must be a reference to dhtmlxGrid object. Answer posted on Apr 20, 2009 06:16 I have used it this way only but i am not getting the effective result function initModals(){ var positioncategory = document.getElementById("positioncategory").value; alert(positioncategory); positionsPartsGrid = new PositionsParts(positioncategory); positionsPartsGrid.initialize(); initPositionsModal(); } function PositionsParts(positioncategory){ var hasRun = false; var self = this; this.grid = new dhtmlXGridObject('positions'); if(positioncategory=="DSA"){alert(1); this.grid.setColTypes("ro,ro,ro,ro,ro,ro,ed,ro,ro,ro,ro,ed,ed,ro,link,ro"); }else{alert(2); this.grid.setColTypes("ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,link,ro"); } position=this.grid; this.grid.setImagePath(imagePath); this.grid.selMultiRows = true; this.grid.setImagePath(anAppContext+"/images/dhtmlx/"); this.grid.setHeader("Position Id,Position Name,Primary Employee Login,Last Name,First Name,Position Category,Position Type,Parent Position Name,SHARE Node Id,Node Type,Structure Name,Start Date,End date,Created Date,Delete,User Key"); this.grid.setColAlign("left,left,left,left,left,left,left,center,center,center,left,center,left,left,center,center"); this.grid.setColSorting("str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str"); this.grid.tooltips("Value,Value,Value,Value,Value,Value,Value,Value,Value,Value,Value,Value,Value,Value,Value,Value"); this.grid.setInitWidths("70,100,90,100,115,70,70,50,60,50,80,70,60,70,50,0") this.grid.enableKeyboardSupport(true); this.grid.enableRowsHover(true,'grid_hover'); this.grid.enableAlterCss("ev_light","odd_mdm"); this.grid.enableCollSpan(true); //Required for child rows this.grid.setSkin("mdm"); this.grid.setEditable(true); this.grid.setPDRPagingWTMode(true,true,true,false,["Results","<B>Showing</B> ","<B> - </B>","Page "," Deals per page"]); this.grid.enablePDRPagingWT(true,"50",null,"recinfoArea_positions"); this.grid.setColumnIds("positionId,positionName,primaryemployeelogin,lastname,firstname,positioncategory,positiontype,parentpositionname,sharenodeid,nodeType,structurename,startdate,enddate,createddate,delete,userkey"); this.grid.getHandler="positionsAction.do?searchType=PDQ"; this.grid.setOnLoadingStart(loadingStart); this.grid.setOnLoadingEnd(loadingEnded); position.setOnEditCellHandler(editCellHandlerPositions); PositionDataProcessor = new dataProcessor("saveposuser.do"); PositionDataProcessor.setUpdateMode("off"); PositionDataProcessor.init(position); function editCellHandlerPositions(stage,rowId, cellIndex, newVal,oldVal){ var primaryemployeeloginColumnIndex = position.getColIndexById('primaryemployeelogin'); var startDateIndex = position.getColIndexById('startdate'); var endDateIndex = position.getColIndexById('enddate'); if (stage == 0 && cellIndex == primaryemployeeloginColumnIndex) { showSearchPositionIdModal(); return true; } if (cellIndex == startDateIndex) { if (stage == 0) { return true; } else if (stage == 2) { var startdate = position.cells(rowId,startDateIndex).getValue(); var enddate = position.cells(rowId,endDateIndex).getValue(); var todayDt = document.getElementById("todayDt").value; if(startdate ==null || startdate ==""){ alert("Please select the value for start date"); return false; } return true; } return true; } if (cellIndex == endDateIndex) { if (stage == 0) { return true; } else if (stage == 2) { var startdate = position.cells(rowId,startDateIndex).getValue(); var enddate = position.cells(rowId,endDateIndex).getValue(); var todayDt = document.getElementById("todayDt").value; return true; } return true; } return true; } function loadingStart (){ document.getElementById("recinfoArea_positions").style.display="none"; loadingImage("positions"); } function loadingImage (objectId) { if(document.getElementById("loadingImageId")){ return; } var anImg = document.createElement("img"); anImg.id="loadingImageId"; anImg.src=loadingImagePath; anImg.style.position="absolute"; var theDiv = document.getElementById(objectId); theDiv.appendChild(anImg); theTop = ((theDiv.offsetHeight-anImg.offsetHeight)/2)+"px"; theR = ((theDiv.offsetWidth-anImg.offsetWidth)/2)+"px"; anImg.style.top=theTop; anImg.style.left=theR; } function loadingEnded() { // hasRun = false; document.getElementById('positions').removeChild(document.getElementById("loadingImageId")); document.getElementById("recinfoArea_positions").style.display="block"; if((!hasRun) || (self.grid.counterRefreshed)) { //alert(self.grid.UserData["gridglobaluserdata"]); var totalNoOfPages; var zeroRecords = true; if(self.grid.UserData["gridglobaluserdata"] != null){ zeroRecords = false; self.grid.pdrNoOfRows = self.grid.UserData["gridglobaluserdata"].get("nooflines"); if(self.grid.pdrNoOfRows==0){ totalNoOfPages = 1; zeroRecords = true; }else{ totalNoOfPages = Math.ceil(self.grid.pdrNoOfRows/self.grid.rowsBufferOutSize); } }else{ self.grid.pdrNoOfRows = 0; totalNoOfPages = 1; } var sButton = self.grid.aToolBar.getItem("pages"); sButton.clearOptions(); for(var i=0;i<totalNoOfPages;i++){ sButton.addOption((i+1),(i+1)); } if(self.grid._WTDef[2]){ self.grid.aToolBar.enableItem("right"); self.grid.aToolBar.enableItem("left"); if(self.grid.currentPDRPage==totalNoOfPages){ self.grid.aToolBar.disableItem("right"); } if(self.grid.currentPDRPage==1){ self.grid.aToolBar.disableItem("left"); } } if(self.grid._WTDef[1]){ var iLr = (((eval(0)+eval(self.grid.rowsBufferOutSize)) <= self.grid.pdrNoOfRows)?(eval(0)+eval(self.grid.rowsBufferOutSize)):self.grid.pdrNoOfRows); var iButton = self.grid.aToolBar.getItem("results"); if(!zeroRecords){ iButton.setText("<B>"+self.grid._WTlabels[1]+(1)+self.grid._WTlabels[2]+(iLr)+" of "+self.grid.pdrNoOfRows+"</B>"); }else{ iButton.setText("<B>No Records</B>"); } } hasRun = true; self.grid.counterRefreshed = false; //position.cells(newId,14).setLabel(deleteImage); } } } tHIS IS HOW I AM DOING..BUT IM NOT GETTING THE DESIRED RESULT. Answer posted by dhxSupport on Apr 20, 2009 06:44 Try to move setColTypes after setHeader method. |