Results 1 to 2 of 2

Thread: Move Grid's rows up and down using button

  1. #1
    Sencha User
    Join Date
    Sep 2013
    Location
    Brisbane, Australia
    Posts
    14

    Default Move Grid's rows up and down using button

    Hi, I was going through ext js support forum and found below solution for moving grid's rows up and down but it seems to be working in Ext2.x but not with Ext 4.x. It seems that there is no method as getSelected() in new version of Ext js. Can someone please let me know how to get below code working?

    getSelected() Method is not present any more


    I am getting error saying getSelected() method is not present. What changes to be done in this code to move grid's row up and down working?

    var record = grid.getSelectionModel().getSelected();
    if (!record) {
    return;
    }
    var index = grid.getStore().indexOf(record);
    if (direction < 0) {
    index--;
    if (index < 0) {
    return;
    }
    } else {
    index++;
    if (index >= grid.getStore().getCount()) {
    return;
    }
    }
    grid.getStore().remove(record);
    grid.getStore().insert(index, record);
    grid.getSelectionModel().selectRow(index, true);

  2. #2
    Sencha User
    Join Date
    Sep 2011
    Posts
    574
    Answers
    59

    Default

    Try getSelection()[0].
    But I must warn you, that this code can't be extended for case with multiple selections.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •