jQWidgets Forums

jQuery UI Widgets Forums Grid Get column FieldName

This topic contains 1 reply, has 2 voices, and was last updated by  Martin 6 years, 8 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Get column FieldName #102159

    dishmann
    Participant

    Hi all,

    I could not find how to do this in the API or by searching this forum.
    OK here is what I am trying to do.

    I have added a row to the top of my grid. Works great. But….. 🙂
    After the row is added, I want to select the first (leftmost) column in the new row at the top of the grid so the user can begin to edit the row.
    The Grid API has a selectcell method that will do that. (My grid mode is singlecell) However, that method requires a datafield.

    I allow the user to re-order the grid columns. So from what I understand the first column in the grid can be any one of the columns depending on how the user may have re-arranged the columns. Thus I cannot guarantee what the leftmost datafield is so I can make the call to selectcell method after I add a new row to the grid.

    I know there must be a way to do that. Perhaps my understanding of the column arrangement after the ordering is changed by the end user is incorrect.

    Would you please point me in the right direction to accomplish my goal.

    Thanks

    Get column FieldName #102176

    Martin
    Participant

    Hello dishmann,

    You can get the datafield of the first column at any time using:
    $("#grid").jqxGrid('columns').records[0].datafield

    Also, in the columnreordered event handler you have the datafield, oldindex and newindex of the moved column.

    Best Regards,
    Martin

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

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

You must be logged in to reply to this topic.