jQWidgets Forums

jQuery UI Widgets Forums Grid Get rowData by index

This topic contains 3 replies, has 2 voices, and was last updated by  Peter Stoev 11 years, 10 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • Get rowData by index #26503

    jon74
    Participant

    Hi all,
    I’d like to know if is possible to get a cell’s value through rowData and column index instead of column datafield id
    i.e.
    var rowData = $(‘#jqxGrid’).jqxGrid(‘getrowdata’, 0); (or var rows = $(‘#jqxgrid’).jqxGrid(‘getdisplayrows’); and then rowData=rows[0]) )
    var value = rowData[0]; //usually should be rowData[‘datafieldname’];

    in this example I should get the first column of the first row in the table value.

    My need is to have a sort of dynamic grid: I don’t know from scratch how many columns I’ll have and the datafields’ names and columns’ definition are built dynamically server side.

    Thanks in advance

    Jonathan

    Get rowData by index #26507

    Peter Stoev
    Keymaster

    Hi Jonathan,

    var value = rowData[0]; will not return the first column’s value. You need to use the column’s datafield to get its value.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

    Get rowData by index #26524

    jon74
    Participant

    Hi Peter,
    that was my question: so it is not possible to get a cell value by index instead of using colum’s datafield?

    Get rowData by index #26596

    Peter Stoev
    Keymaster

    Hi jon74,

    Please, find below a workaround:

    var columnsArray = $(“#grid”).jqxGrid(‘columns’).records;
    var firstColumn = columnsArray[0];
    var value = rowData[firstColumn.datafield];

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.