jQuery UI Widgets Forums DataTable cell "metadata"?

This topic contains 3 replies, has 3 voices, and was last updated by  dayofthedave 10 years, 7 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • cell "metadata"? #53202

    dbs222
    Participant

    Folks- I have a datatable bound to JSON data. I would like to change the background color of a cell based on it’s value and a choice of three other parameters. (for example {“val”: 1.1, “state”: “Above”},{“val”: 0.4, “state”: “Norm”},{“val”: -0.6, “state”: “Below”}. The value of “val” needs to be displayed in the DataTable. However, the paired value of “state” needs to remain hidden, but is tested for the color change. I have successfully changed the background color based on the value of ‘val’ alone. But I need to be able to control when the color gets applied based on whether the state is “Above” or “Below”. The “Above” or “Below” values are discovered based on whether the numeric values are above or below a threshold for five or more consecutive times in the array that I use to build the JSON.

    So the question: Is there a way to bind both the data that gets displayed, and associated hidden ‘metadata’ to individual cells, and then access the metadata using something like getCellValue?

    Thanks!

    -david

    cell "metadata"? #53207

    Peter Stoev
    Keymaster

    Hi David,

    Each DataTable column may have displayField and dataField so you can have text and values in the cells.

    Best Regards,
    Peter Stoev

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

    cell "metadata"? #53237

    dbs222
    Participant

    Thanks Peter! Looking into this now! -david

    cell "metadata"? #57870

    dayofthedave
    Participant

    Hi, David. Did you ever find a solution? I have the exact same requirements for cells with values + metadata, but I’m not finding a solution with displayField and dataField. These appear to be column properties, not cell properties.

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

You must be logged in to reply to this topic.