Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Cido on Apr 15, 2009 07:28
open dhtmlx forum
DataProcessor Issue

Hi guys,
I`ve a datagrid that can be change manually cell by cell and can be changed by group of cels, in the second case for some reason the dataprocessor don't call the update process.

here is my code, can you help me?

//cria o menu de contexto dos itens ja selecionados
menuAlt = new dhtmlXMenuObject(null, "standard");
menuAlt.setImagePath("TreeGrid/codebase/imgs/");
menuAlt.setIconsPath("TreeGrid/codebase/imgs/");
menuAlt.renderAsContextMenu();
menuAlt.setOpenMode("web");
menuAlt.attachEvent("onClick", onButtonClick);
menuAlt.loadXML("TreeGrid/xml/menuAlterar.xml");

mygrid = new dhtmlXGridObject('gridbox');
     mygrid.setImagePath("TreeGrid/codebase/imgs/");
var flds = "Código,Brand ME,Brand MR, Atualizado";
mygrid.setImagePath("TreeGrid/codebase/imgs/");
mygrid.setHeader(flds);
mygrid.setColumnIds("id,brand_me,brand_mr,last_update");
mygrid.setInitWidths("60,255,255,0");
mygrid.setColAlign("center,left,left,left");
mygrid.setColTypes("ro,ro,ed,ro");
mygrid.setColSorting("str,str,str,str");
mygrid.setSkin("light");
//mygrid.setColumnColor("white,,,");
mygrid.enableTooltips("false,false,false,false");
mygrid.setColumnHidden(3,true);
mygrid.init();
//mygrid.loadXML("anun.xml");
mygrid.loadXML("PopulaGrid.aspx?op=2&c="+idcliente);

mygrid.enableContextMenu(menuAlt);

myDataProcessor = new dataProcessor("update.aspx?op=3&c="+idcliente);
myDataProcessor.setUpdateMode("cell");
myDataProcessor.enableDataNames(true);
myDataProcessor.setTransactionMode("POST",true);
myDataProcessor.init(mygrid);
}

function onButtonClick(menuitemId) {
if (menuitemId == "Ren") {
var items = mygrid.getSelectedId().split(",");

novovalor = prompt("new value for the cells: ", "")

myDataProcessor.setUpdateMode("off");
for (var i = 0; i < items.length; i++) {
mygrid.cells(items[i], 2).setValue(novovalor)
myDataProcessor.sendData();
}
myDataProcessor.setUpdateMode("cell");

}

}
Answer posted by dhxSupport on Apr 15, 2009 08:11

Provided code is correct. Please describe how are you changing datagrid by changing group of cells? If you are changing cell value via setValue() method you should mark row as updated manually:

myDataProcessor.setUpdated(rowId,state,mode) where rowId - id of row to set update-status for, state - true for "updated", false for "not updated", mode - update mode name ("updated", "deleted"..)