Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

  • How to add new records to listgrid in client side after fetching from server

    Hi,

    We are using smartgwt 12.0
    Browser : Google chrome.

    I have a grid. When grid is loaded it will auto fetch the data from the server. After fetching already existing records, I need to add new Record from client side without server trip. Fetching from server is working fine. But after that, new record adding is not working. listgrid is not showing newly added records.

    Code :

    // fetching data
    List grid = new ListGrid();
    grid.setDataSource(dataSource);
    grid.setAutoFetchData(true);
    grid.fetchData();

    //Adding new Record

    Recordlist recordList = grid.getRecordList();
    recordList.add(record);
    grid.setData(recordList)

  • #2
    The problem is you need to wait for the data to arrive in a callback before calling .getRecordList(). You can use a DSCallback in fetchData().

    Comment

    Working...
    X