populate row depending on a cell

Hi,
I am trying to create a grid of the following structure

code|description|last date of updation|quantity

here, the code is a column of type co.
The user selects a code from the list and the rest of the row should get populated according to the code.

Is it possible to access the code selected by the user using events?
Please help. It is an urgent requirement.

You may try to use the onEditCell event to control all edit operations in your grid:
docs.dhtmlx.com/doku.php?id=dhtm … oneditcell

Hi sematik,
Thank you for your reply. I did go with this event but I was unable to access the data depending on the selected value , since i can not use the javascript value in java code and the data needs to come from the database.
If you could help me with that, I would be most grateful. :frowning:

Unfortunately your issue is not clear.
Only the currently selected cell can be edited.
Could you clarify the required scenario.

Hi,
The task is something like this.
I have a grid that has some empty rows.The structure of the grid is this.

code|description|last date of updation|quantity

now, for each row, the code column is a selectbox that has some values coming from the database.
When the user selects a code from the list, the rest of the row needs to be filled with data associated with the code.

for example:
initially,
code|description|last date of updation|quantity

after selecting code,
code|description|last date of updation|quantity
123 | desc | 2014/1/12|5

I am able to get the value 123 using the onEditCell event but how do i use it to populate the row?

Aah, done using dhtmlxAjax.
Wasn’t so sure about using xml so used responseText and it works .

Now I have another problem.
I can get the data and populate the row.
The grid has another column direction so that the structure is now,
code|description|last date of updation|quantity|direction

after populating the row looks something like this.

code|description|last date of updation|quantity|direction
123|description|2014/1/12|5|

The moment i edit the direction cell, the rest of the data vanishes. :frowning:

What do i do to prevent that?

onEditCell event has the attributes of the current editing cell (row id, cell index) so you may run the needed code only for the needed cells.
You may set/get the value of any needed cell using the setValue/getValue methods.
var val=grid.cells(rId,colInd).getValue()
grid.cells(rId,colInd).setValue(val)

If any issue still occurs for you - pleas,e provide with any kind of sample of your code.

Hi sematik,
Thank you for your help.
It worked :slight_smile:
I used your advice and restricted the onEditCell event to that specific column and it worked.