Insert selected rows

  1. 6 months ago

    Joel_Eisenstat

    2 Mar 2019 User since 2016

    Good morning,
    Some direction in transferring selected rows from one to TableView to an other is appreciated.
    // transfer selected rows only
    var translist = TableView1.selectedRows; // list of index paths
    TableView2.insertRows(?, translist, 100); // indexpaths?
    TableView2.reload(true, true);
    I am not sure of how to provide the first parameter of index paths.
    Thanks
    Joel

  2. @Joel_Eisenstat The first parameter must be an object of IndexPath type. The easiest way to build is to use function IndexPath(). Check https://docs.creolabs.com/classes/IndexPath.html in section Initializers.
    So something like TableView2.insertRows(IndexPath(0,1), translist, 100);

    Just remember that the second parameter must be a Map with content for this row. Keys should be the same like properties you use for populating cells (eg. identifier, Name...). More about Maps you can find here: https://docs.creolabs.com/gravity/map.html

    If you use insertRows() there's no need to reload the tableView after.

  3. Joel_Eisenstat

    3 Mar 2019 User since 2016

    Hey Konrad,
    Thanks on that path with ;
    var map = ["id":identifier,"date":text,"code":text]; //exposed property
    var translist = TableView1.selectedRows; // list of index paths
    for ( var index in translist) { //index path
    TableView2.insertRow(index, map, 100)
    }
    Just hung up on the map list at the moment
    No errors but values are not seen in TableView2 but the rows seem to be there

  4. Joel_Eisenstat

    3 Mar 2019 User since 2016

    map = ["id":rs.stringValue(0),"date":rs.stringValue(1),"code":rs.stringValue(2)]
    just now have to move it along the selectedRows list ....

or Sign Up to reply!