Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Udhaya on Apr 11, 2008 04:17
open dhtmlx forum
Load XML without server side Knowldege

I have a one scenario in our project.

If a row is selected and click one button
the remaining rows are should be changed in grid itself without the server side knowledge.
for Example:
---------------
I have 2 columns in grid
and 3 rows. These rows and columns are get from the database. I am using JSP and Struts Application for Loading Data in Grid

RowId Taskname
-------------------------
1.1 task1
1.2 task2
1.3 task3

if suppose I selected the Row 1.2 and click a Indent button
At the time I have to change the Grid row values 1.2 to 1.1.1, 1.3 to 1.1.2
without the knowledge of database.. There should not update in database..

How can I load the XML with these changes without page refresh...
When click the save button then only it saved in database.

Please Help me in this situvation

Thanks and Regards
Udhayabalachandar
Answer posted by Support on Apr 11, 2008 04:59
You can change values on client side by using
    grid.cells(i,j).setValue(new_value);

In case above it can be done as

function indent(row_index){
    var start_value=grid.cells2(i,0).getValue()
    for (var i=row_index; i<grid.getRowsNum(); i++){
       grid.cells2(i,0).setValue(start_value+"."+(i+1));
       grid.cells2(i,0).cell.wasChanged=true; //mark cell as updated, so it will be saved in DB later
    }
}
Answer posted by Udhaya on Apr 12, 2008 02:24

How to get the particular column value from selected Row in grid

for eg

Row  TaskNo  Task Name

------------------------------------

1        1.1      Testing

2         2.1      Design

3        2.2        Coding

 

if suppose I selected the 2nd row.. How can I get the Taskno 2.1 in my Grid

 

Answer posted by Support on Apr 14, 2008 02:07
You can get value of cell as

    var value = grid.cells(grid.getSelectedId(),1).getValue();

where 1 - index of columns ( indexes are zero based, so for second column it will be 1 )