Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Alim Hassam on Aug 06, 2008 12:37
open dhtmlx forum
Block selection

Hi,
I'm using the pro version 1.6 build 80319.
I have a few different questions:
One of the main feature we are using from the dhtmlx grid is the block selection. I would like to know how to select something on the grid in javascript. The selection is stored on the server side and i would like that to appear when i load the page if the user comes back to that grid.

I tried
mygrid._selectionArea = mygrid._RedrawSelectionPos(mygrid.cellByIndex(#{selectedRegion.leftTopRow},#{selectedRegion.leftTopCol}),mygrid.cellByIndex(#{selectedRegion.rightBottomRow}, #{selectedRegion.rightBottomCol}));

But it doesn't work.

Secondly, i'm not able to make the mygrid.updateFromXML() function work. It doesn't seem to refresh my grid. Is there something i'm not doing properly?

Thank you,
-Alim
Answer posted by Support on Aug 07, 2008 01:43

>> I would like to know how to select something on the grid in javascript.
Can be done as
  mygrid._CreateSelection();
  mygrid._ShowSelection();
  mygrid._RedrawSelectionPos(
         mygrid.cellByIndex(#{selectedRegion.leftTopRow},#{selectedRegion.leftTopCol}).cell,
         mygrid.cellByIndex(#{selectedRegion.rightBottomRow}, #{selectedRegion.rightBottomCol}).cell
  );


>> mygrid.updateFromXML() 

If called only with url parameter
           mygrid.updateFromXML(url) 
The command will fetch provided url and update rows based on their ID (for each row in XML , if row in grid with such ID exists it will be updated with new data )
If you need to add|delete rows as part of update you need to use 2nd and 3rd parameters of command. 

If you need just reload grid with new data it can be done as
         grid.clearAll();
         grid.loadXML(url);