Author Topic: Get RowIndx on Tree mode  (Read 2596 times)

nz

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 5
    • View Profile
Get RowIndx on Tree mode
« on: March 18, 2019, 01:18:33 pm »
Hi,

i am tring to use the getRowIndx in Tree mode after adding a new row using Tree.addnodes method.

   var newRow = { "id": 3444565, "parentId": 0, "Code": "232343423", "Price": 0, "Quant": 0 };
                    Tree.addNodes([
                        newRow
                    ])
                    var obj = $("#quantTableContainer").pqGrid("getRowIndx", { rowData: newRow });

i getting worng index number why ?

on more thing, i am trying to get the last row of the grid (in tree mode) like this :

                    var obj = $(".selector").pqGrid("getViewPortIndx"),
                        initV = obj.initV,
                        finalV = obj.finalV,
                        initH = obj.initH,
                        finalH = obj.finalH;

but the finalV is worng (ihave like 1600 rows but getting 18) is it counting only the parents ??

please help

thanks

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6263
    • View Profile
Re: Get RowIndx on Tree mode
« Reply #1 on: March 18, 2019, 09:43:14 pm »
1. Please share a jsfiddle/ plnkr.

2. getViewPortIndx provides the rowIndx of rows in the scrollable viewport, obj.finalV provides index of last rendered row in the viewport, so 18 seems correct.

To get last row, use

Code: [Select]
var data = grid.pageData();
var row = data[data.length-1]

nz

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Get RowIndx on Tree mode
« Reply #2 on: March 19, 2019, 12:41:03 pm »
Thanks  :D