error in listgrid

i have a listgrid bound to a xml datasource, and two buttons, the first makes a fetchData operation and the second button makes a addData operation, when i push the add button in first place the listgrid dont shows the added record being necessary press the fetch button before the add button (so the add record is showed in the listgrid). I want to know why happend this and how can i resolve it.
the code is:

isc.DataSource.create({
ID:“contacts”,
dataFormat:“xml”,
recordXPath:“//Table”,
//dataURL:http://192.168.1.9/Webservice2/service2.asmx/executeQuery?sSql=%20,
fields:{
au_id:{name:“au_id”},
au_lname:{name:“au_lname”},
au_fname:{name:“au_fname”},
address:{name:“address”}
},
operationBindings:
[
{
operationType:“fetch”,
dataFormat:“xml”,
recordXPath:“//Table”,
dataURL:“http://192.168.1.9/Webservice2/service2.asmx/executeQuery”
},
{
operationType:“add”,
dataFormat:“xml”,
recordXPath:“//Table”,
dataURL:“http://192.168.1.9/Webservice2/service2.asmx/insert”
}
]

});

isc.ListGrid.create({
ID: “boundGrid”,
dataSource: “contacts”,
width: “100%”,
height:“80%”,
//autoFetchData: true
canEdit:true,
editByCell:true,
headerHeight:15
}); isc.IButton.create({
title: “fetch”,
width: 120,
left: 100,
top: 350,
click: “boundGrid.fetchData({sSql:’ '});”
});

isc.IButton.create({
title: “Add”,
width: 120,
left: 250,
top: 350,

click: function ()
{
boundGrid.addData({au_id:’ ‘,au_lname:’ ‘,au_fname:’ ‘,address:’ '});
}

});

Hi Alex
This is the expected behavior:

  • a databound listGrid will not display the dataSource data (from the server) until either fetchData() or filterData() is called on the grid.
  • Setting ‘autoFetchData’ to true simply means that when the grid is drawn, it will perform a fetchData() call automatically.

addData() adds a row to the dataSource associated with the grid,. If the grid is already displaying this data (as filterData() has already been called), the new row will show up - otherwise it will not [though it should be added to the server data regardless].
If you call filterData() after calling addData(), the newly added row will show up in the data returned from the server (assuming it matches the filter criteria).

What behavior are you trying to achieve? If you let us know what your use-case is we may be able to make some recommendations

Thanks
Isomorphic Software

error in listgrid

Hi, thanks for your fast answer, i understand all that you say in your message, but i think the logical behavior most be that when a record was added to a dataset (or listgrid) using addData. the bound control (in this case a listgrid) most show the added record (without use a fetch or filterdata). this is that i want to do.
Thanks

Hi Alex,

You can get the behavior you’re looking for by just calling fetchData() on the grid with filter criteria that match only the newly added record(s).

Alternatively you can call setData() with the newly added record(s) in an Array. This will cause the grid to manage the provided data as a local-only dataset until you call fetchData().

In contrast, the behavior you suggest would interfere with other use cases. A grid which has not had fetchData() called on it must not assume it is connected to a remote dataset because there are other ways of using such a grid.

the things that you say are logic, i believe that the second point (use setData) could be the solution for me, so if the listgrid dont show any records (at begin), and the user wants to add a record, still so it would be showed. i think i most to try this.
thanks for you help.