select multiple rows and then perform an action

Hi,

how is it possible to select multiple rows and then perform an action. Extra print or status “XY” put or delete.

Is my question is too complicated?

You can get the list of selected rows as

and after that execute necessary operation for each row

var ids = grid.getSelectedRowId() if (ids){ ids = ids.split(","); for (var i=0; i,ids.length; i++) grid.deleteRow(ids[i]); }

as for row deleting - there is a separate method - grid.deleteSelectedRows()

And how can I set a Value of the selected row??

If i do it like this it wont work?

var ids = grid.getSelectedRowId() if (ids){ ids = ids.split(","); for (var i=0; i,ids.length; i++) mygrid.getCombo(ids[i],19).value = "3"; }
or

var ids = grid.getSelectedRowId() if (ids){ ids = ids.split(","); for (var i=0; i,ids.length; i++) mygrid.cellById(ids[i],5).value = "testing"; }

Is there a example somewhere? Or can you show me how? It also should both be changed server side and client side.

Correct one

var ids = grid.getSelectedRowId() if (ids){ ids = ids.split(","); for (var i=0; i,ids.length; i++) mygrid.cellById(ids[i],5).setValue("testing"); }

docs.dhtmlx.com/doku.php?id=dhtm … of_excells

Thank You!

But how can i save it in my database?

If I set the changed flag true it wont work

mygrid.cell(ids[i], 19).cell.wasChanged=true; 

What else do i have to do?

If you are using dataprocessor ( which is one of way of data saving ) , you need to

a) set wasChanged flag
b) trigger update by
dp.setUpdated(id, true);

where
dp - dataprocessor instance
id - id of the row

( if you changing data by UI actions - it will be done automatically, but in case of changes through API those additional steps are necessary )

Thanky You for yout help!

But it doesnt work. It still does not save the data. What do i do wrong?

Here is my Code:
I work with the dataprocessor:

if ( id == "archivieren"){ var ids = mygrid.getSelectedRowId(); if (ids){ ids = ids.split(","); for (var i=0; i,ids.length; i++){ if (mygrid.cells(ids[i], 19).setValue("4")){ mygrid.cell(ids[i], 19).cell.wasChanged=true; myDataProcessor.setUpdated(ids[i], true); } } } }

Try to change

if (mygrid.cells(ids[i], 19).setValue("4")){ mygrid.cell(ids[i], 19).cell.wasChanged=true; myDataProcessor.setUpdated(ids[i], true); }

as

                        mygrid.cells(ids[i], 19).setValue("4");
                        mygrid.cells(ids[i], 19).cell.wasChanged=true;
                        myDataProcessor.setUpdated(ids[i], true);