Iam trying move rows between two grids and iam having the following problems:
1) When i set the auto height property to true (mygrid.enableAutoHeight(true)) the grid from which the rows are moved is being replaced with blank rows with white space. Does the auto height feature work with mygrid.moveRow functionality??
2)I have defined dataprocessors for both the grids. So when i move a row or rows from grid1 to grid2 the rows from grid1 are marked as deleted and the rows in grid2 are marked as inserted which is correct. But when i hit the save button (onclick=“myDataProcessor.sendData();myDataProcessor2.sendData();”) the rows marked for deletion are still present in the first grid.Here is the code i used to initialize the grids
mygrid = new dhtmlXGridObject(‘gridbox1’);
mygrid.setImagePath(“codebase/imgs/”);
mygrid.enableMultiselect(true);
mygrid.preventIECaching(true);
mygrid.enableAutoWidth(true);
mygrid.init();
mygrid.loadXML(“grid.xml”);
myDataProcessor = new dataProcessor(‘Update.aspx’);
myDataProcessor.setUpdateMode(“off”);
myDataProcessor.enableDataNames(true);
myDataProcessor.setTransactionMode(“GET”);
myDataProcessor.init(mygrid);
myDataProcessor.enableDebug(true);
mygrid2 = new dhtmlXGridObject(‘gridbox2’);
mygrid2.setImagePath(“codebase/imgs/”);
mygrid2.enableMultiselect(true);
mygrid2.preventIECaching(true);
mygrid2.enableAutoWidth(true);
mygrid2.init();
mygrid2.loadXML(“grid2.xml”);
myDataProcessor2 = new dataProcessor(‘Update2.aspx’);
myDataProcessor2.setUpdateMode(“off”);
myDataProcessor2.enableDataNames(true);
myDataProcessor2.setTransactionMode(“GET”);
myDataProcessor2.init(mygrid2);
myDataProcessor2.enableDebug(true);
3) I dont want users to move rows which are deleted or inserted or updated and i have created the following function:
function MoveFromGrd1ToGrd2()
{
var ids = mygrid.getSelectedId().split(’,’);
for(var i=0;i<ids.length;i++)
{
if(myDataProcessor.obj.getUserData(ids[i],"!nativeeditor_status") == ‘’)
{
mygrid.moveRow(ids[i],“row_sibling”,mygrid2.getSelectedId(),mygrid2);
}
else
{
if(myDataProcessor.obj.getUserData(ids[i],"!nativeeditor_status") == ‘deleted’)
{
alert(‘Row ‘+ids[i]+’ has already been moved’);
}
else
{
alert(‘Row ‘+ids[i]+’ has been updated or inserted and cannot be moved’);
}}}}
The above code works well for delete and insert but it dosent work for update because the nativeeditor_status element is not availiable for update. Below are the dataprocessor debug messages:
For Insert:
Send data to server
URL:Update.aspx?
Data:gr_id=300&=-200&undefined=The%20Rainmaker&undefined=John%20Grisham&undefined=7.99&undefined=0&undefined=48&undefined=0&undefined=12%2F01%2F2001&!nativeeditor_status=inserted
For Delete:
Send data to server
URL:Update.aspx?
Data:gr_id=3&=-200&undefined=The%20Rainmaker&undefined=John%20Grisham&undefined=7.99&undefined=0&undefined=48&undefined=0&undefined=12%2F01%2F2001&!nativeeditor_status=deleted
For Update:
Send data to server
URL:Update.aspx?
Data:gr_id=4&=350&undefined=dk&undefined=Stephen%20King&undefined=11.10&undefined=1&undefined=24&undefined=0&undefined=01%2F01%2F1992
How can i get the nativeeditor_status to show as updated for updated rows?
Does the auto height feature work with mygrid.moveRow functionality??
The height of grid is not updated automatically after such operation, to resolve problem you can use next code
grid.moveRow(…
grid.setSizes(); //force update of size
>>the rows marked for deletion are still present in the first grid
The problem may be caused by server side response. To be processed correctly it must be correct XML
action@type = “delete”
actiion@sid = action@tid = “id or row”
>>3) I dont want users to move rows which are deleted or inserted or updated and i have created the following function:
You can use code similar to next
if(myDataProcessor.findRow(ids[i])!=-1){
alert(“row was updated”);
}