I use dhtmlxCalendar in a dhtmlxGrid cell, I got all cell value from the method of getValue(), but can not get the dhtmlxCalendar field value…
init grid code :
--------------------------------------------------------------------------------------------------
cGrid = new dhtmlXGridObject(‘clientGrid’);
cGrid.setImagePath("…/…/…/inc/js/editgrid/imgs/");
cGrid.setColumnIds"Column1,Column3,Column3");
cGrid.setHeader(“Column1,Column3,date”);
cGrid.setInitWidths(“30,150,*”);
cGrid.setColTypes(“ro,ed,dhxCalendar”);
cGrid.setColAlign(“right,left,left”);
cGrid.setColSorting(“int,str,date”);
cGrid.init();
cGrid.setSkin(“dhx_skyblue”);
--------------------------------------------------------------------------------------------------
get value code :
--------------------------------------------------------------------------------------------------
getGridData: function(){
var allItemID = new Array(0);
var modiItemID = new Array(0);// copy of allitemid
var a = 0; // modiItemID array index
var iflag = 0;
var saveFlag = false;
var blankFlag = false;
var gridColumns = this.getColumnCount();
var dataXML = null;
allItemID = this.getAllItemIds().split(",");
// rows
for (var i = 0; i < allItemID.length; i++) {
var modiFlag = false;
// columns
for(var j = 0; j < gridColumns; j++){
if(this.cells(allItemID[i],j) != null) {
if(this.cells(allItemID[i],j).wasChanged()){
modiFlag = true;
}
var cellValue = this.cells(allItemID[i],j).getValue(); //==============this is the method getvalue
if (cellValue != “” && cellValue.length != 0 && cellValue != null) {
iflag++;
}
}
}
if (iflag > 1) {
modiItemID[a++] = allItemID[i];
}
}
if(modiItemID.length > 0){
dataXML = “<?xml version='1.0' encoding='UTF-8'?>”;
for(var i = 0; i < modiItemID.length; i++){
if(modiItemID[i].length > 0){
dataXML += “”;
for(var j = 0; j < gridColumns; j++){
dataXML += “”;
var cellValue = this.cells(modiItemID[i],j).getValue();
if(cellValue.indexOf("<") != -1){
dataXML += cellValue.substring(cellValue.indexOf(">")+1, cellValue.indexOf("</"));
} else {
dataXML += cellValue;
}
dataXML += “”;
}
dataXML += “”;
}
}
dataXML += “”;
}
return dataXML;
},
--------------------------------------------------------------------------------------------------
pls help me, How to I get the dhtmlxCalendar field values in my dhtmlxGrid…
thanks verry, verry much
Is the issue solved ?
method getValue() works for all cell types and dhxCalendar as well. Please, check that value is set in the cell when you call getValue method.
I can get the vaule by “grid.cells(…).cell.innerHTMl”.
The date is insert calender cells when output the div html code , but I can’t get the value by getValue()
The value should be set using grid API to be got by getValue() method:
grid.cells(rowid,cellIndex).setValue(date);