Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Accessing data in ListGrid "hidden" fields

    I'm using values within certain ListGrid fields to provide formatting for a row and also to prevent edits on certain rows. I generally obtain this information via the ListGrid.getCellValue(record, row, col). However, if a user hides my data field I can no longer access the values in this way.

    In my grid, I also utilize a hidden field (defined in the datasource with attributes -- hidden:"true"), to contain the primary key for the row. This attribute seems only to minimize the column width to 0, as the field still exists in the grid fields array. I've found that if I subsequently "hide" the field, by right-clicking on the grid column header and unchecking the field, the fields.getLength() method for the grid shows that there is one fewer field in the fields array. However, the primary key data presumably still exists since the grid correctly submits data to the backend.

    I've tried to find a way to get the data from the ResultSet via the ListGrid.data property, but can't seem to make it work. Any suggestions? Is there a better way to accomplish what I'm trying to do?

    Thanks,

    Curt

    #2
    grid.data.get(index) gives you a ListGridRecord, which is just a JavaScript Object whose properties may be accessed normally, eg, record.primaryKeyFieldName.

    Note hidden:"true" vs hide() have identical affect, but if you are looking at the grid.fields Array before vs after draw(), the field may not have been removed from the fields Array yet.

    Comment

    Working...
    X