Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

Why ListGrid.getTotalRows() doesn't count my new record created?

$
0
0
Version: SNAPSHOT_v9.1d_2013_10_15

Hi Isomorphic/All,

I've been struggling with the issue of put the focus on a recent record created using addData() to later start editing it, the code is something like this:

// Imagine that the grid has 2 rows
// Then we execute (with an ADD NEW button):

Code:

    myGrid.addData({
      field1: 'value1',
      field2: 'value2'
    });

    var rows = myGrid.getTotalRows();
    myGrid.startEditing(rows);

Instead of return '3 rows' it returns again 2 and I get an 'undefined' error.
I made a test using a setTimeout() with 1sec, then I call:
myGrid.getTotalRows(); and this time I get 3 records.

Why happens that?
Is there another way to put the focus on the new created/stored record in the Database?

Any advice/suggestion will be appreciated.

Thanks

Viewing all articles
Browse latest Browse all 4756

Trending Articles