Binding to Grid

I’m trying to bind a form (in a pop up window) to a grid on the page. The window is spawned via rowDblClick.

I’m noticing that when I bind to the grid right after form creation that the currently selected row is not sync’d into the form. I’ve had to hack it to basically unselect the row and reselect it after the bind so that the values would fill in the form.

But that seems to cause other problems after the first time running.

Is there a better way of doing this? I was thinking about making a single form and binding it on load, then just attach as needed.

Hello,

the 3.0 version allows provides DataStore library with ready solutions for binding components.

Please have a look at the article:
docs.dhtmlx.com/doku.php?id=dhtm … ep_example

I’m using 3.0 with a datastore. Right now it’s DataStore -> Grid -> Popup Form

The problem, again, is that when the form is created and bound during the onRowDblClick event from the grid. Normally you’d bind the form BEFORE the user selects a row from the grid, but I wanted to have the user double click a row to edit it.

The issue arises because when the form binds to the grid it does not attempt to populate based on the currently selected row, which IMO it should be doing.

It would be better to use one form. If a form is shown in dhtmlxwindow, you may use the following approach:

[code]/create a window/
dhxWins = new dhtmlXWindows();
win = dhxWins.createWindow(“w1”, 10, 10, 350, 430);

/place a form in it/
form = win.attachForm(formData);
form.bind(grid);

/hide a window/
win.hide();

/to hide the window when close button pressed/
win.attachEvent(“onClose”,function(){
win.hide();
});

/show window on double click/
grid.attachEvent(“onRowDblClicked”,function(){
win.show();
});[/code]