form.reset() seems to do nothing on a form that is bound to a grid, which is in turn synced to a datastore. Like this:
var dsRestaurants = new dhtmlXDataStore({ url:'./codebase/data/rest_data.php', datatype:'xml' });
...
dpRestaurants = new dataProcessor('./codebase/data/rest_data.php');
dpRestaurants.init(dsRestaurants);
...
restaurant_grid.sync(dsRestaurants);
...
detail_form.bind(restaurant_grid);
...
detail_form.attachEvent("onButtonClick", function(id){
var prevRecord = restaurant_grid.getSelectedRowId();
if (id=='btn_submit'){
detail_form.save();
}
else if (id=='btn_cancel'){
detail_form.reset(); <---DOES NOTHING
}
My temporary workaround is to move the grid off the current record and back, like so.
else if (id=='btn_cancel'){
restaurant_grid.selectRowById(+prevRecord + 1); //wouldn't have to do this if detail_form.reset method worked here
restaurant_grid.selectRowById(prevRecord);
}
This works okay, but has some drawbacks, so if I could get a hint as to how to make the reset method work, I’d appreciate it.
Thanks.
TAC