Author Topic: How do I get the value of numberCell?  (Read 6622 times)

Robert

  • Pro Economy
  • Newbie
  • *
  • Posts: 26
    • View Profile
How do I get the value of numberCell?
« on: April 18, 2014, 05:46:53 pm »
Follow up question ...

I would like to access the value of the numberCell from the rowData if that is possible.

This gives me the numberCell object
         var num_cell = $grid.pqGrid( "option", "numberCell" );

Is there a way to get the value of a particular row's numberCell something like this:
        var num_cell = $grid.pqGrid("getNumberCell", { rowIndx: rowIndx });

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6263
    • View Profile
Re: How do I get the value of numberCell?
« Reply #1 on: April 18, 2014, 07:16:15 pm »
value of number Cell is equal to rowIndxPage

http://paramquery.com/pro/tutorial#topic-rowIndx

Robert

  • Pro Economy
  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: How do I get the value of numberCell?
« Reply #2 on: April 18, 2014, 07:23:10 pm »
Thank you!

Robert

  • Pro Economy
  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: How do I get the value of numberCell?
« Reply #3 on: April 19, 2014, 12:28:15 am »
I am sorry ... I read the tutorial and understand it. However, I am still stuck on the syntax to retrieve the numberCell value.

I get the recID with:
     var recID = $grid.pqGrid("getRecId", { rowIndx: rowIndx });

Similar syntax doesn't seem to work for getting the rowIndxPage. I have tried every variation I can think of similar to this:
     var num_cell = $grid.pqGrid("option", { rowIndxPage: rowIndxPage });

Suggestons?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6263
    • View Profile
Re: How do I get the value of numberCell?
« Reply #4 on: April 19, 2014, 01:18:41 am »
May I know the context. How did you get rowIndx in the first place? Most of the events supply both rowIndx and rowIndxPage.

var rowIndx = ui.rowIndx;
var rowIndxPage = ui.rowIndxPage;
« Last Edit: April 19, 2014, 01:20:45 am by paramquery »

Robert

  • Pro Economy
  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: How do I get the value of numberCell?
« Reply #5 on: April 20, 2014, 02:06:39 am »
I may not be describing what I am needing very well. I will try to do better here.

This is how I am getting the rowIndex in the first place:       
        var rowIndx = ui.rowIndx;

Both of the statements get their respective recId numbers just fine:
        var recID = $grid.pqGrid("getRecId", { rowIndx: rowIndx });
        var recId_page = $grid.pqGrid("getRecId", { rowIndxPage: rowIndxPage });

What I am really looking for is the ability to get the value displayed in the numberCell column (row count), for a particular row, so I can make a comparison against it. I want to be able to catch the last row currently being displayed, regardless of how many pages of rows are in the current dataset. If I could get the values in the numberCell column, that would do it. Is that value available in ether of the following?
 
        var rowData = $grid.pqGrid("getRowData", { rowIndx: rowIndx });
        var rowData_page = $grid.pqGrid("getRowData", { rowIndxPage: rowIndxPage });

If so, would have a suggested get for them? If not, could you please suggest an approach for getting that numberCell value OR an alternative?

Robert

  • Pro Economy
  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: How do I get the value of numberCell?
« Reply #6 on: April 21, 2014, 07:06:53 am »
Thank you for helping me fumble my way through this.  :D  I have figured out from the row selection sample code that this will give me the values I need to do what I want:

obj.rowSelect = function (evt, obj) {
        var dataCell = obj.dataModel.data[obj.rowIndx].join(", ");
        var rowIndx = parseInt(obj.rowIndx);
        }

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6263
    • View Profile
Re: How do I get the value of numberCell?
« Reply #7 on: April 21, 2014, 09:11:53 am »
If you are still looking to get the value in numbercell for a specific row,

var numberCellValue = ui.rowIndxPage + 1;

1 is added because rowIndxPage is a zero based index while numberCellValue begins from 1.