jQWidgets Forums

jQuery UI Widgets Forums Grid Grid column details from selected row

This topic contains 5 replies, has 3 voices, and was last updated by  JMS786 11 years, 9 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • Grid column details from selected row #25017

    prabhu
    Member

    Hi ,

    Is there a way to get column details from the selected row?

    The following code gets rowindex.

    var rowindex = $(gridName).jqxGrid(‘getselectedrowindex’);

    Is there a similar kind of API to get column details from the row’s cell that we have selected.

    Thanks,
    Kishore


    Dimitar
    Participant

    Hello Kishore,

    When you have the selected row’s index, you can use it in the method getrowdata to get the desired column information.

    Best Regards,
    Dimitar

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


    prabhu
    Member

    Hi Dimitar,

    Thanks for your reply. Can you show me a sample code which does that,or a demo which can help me.

    thanks,
    Kishore


    prabhu
    Member

    Is there a way to get column name or index from the cell that we have selected,with out binding cellselect event.

    Thanks,
    Kishore


    Dimitar
    Participant

    Hi Kishore,

    1) Here is a sample code:

    var rowindex = $(gridName).jqxGrid(‘getselectedrowindex’);
    var data = $('#jqxGrid').jqxGrid('getrowdata', rowindex);

    The fields of the data object contain the column values.

    2) Here is an example on the cellselect event:

    $("#jqxGrid").on('cellselect', function (event) 
    {
    var columnheader = $("#jqxGrid").jqxGrid('getcolumn', event.args.datafield).text;
    var rowindex = event.args.rowindex;
    });

    Best Regards,
    Dimitar

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

    Grid column details from selected row #26186

    JMS786
    Participant

    Hi Dimitar,

    I have similar problem, but when i apply your code, especially in this line

    var columnheader = $("#jqxGrid").jqxGrid('getcolumn', event.args.datafield).text;

    I get an error :
    Uncaught TypeError: Cannot read property ‘datafield’ of undefined.

    I have tried to copy the code, but the different is i use the grid as an input tool, therefore my grid does not have source:dataAdapter.

    Do you think the absence of source:dataAdapter is the main problem or that should be no problem?

    If no problem how do I fix the ‘datafield’ error.

    Thanks,
    JMS

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

You must be logged in to reply to this topic.