Author Topic: Additional meta data in the datamodel  (Read 2739 times)

stoodin

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 85
    • View Profile
Additional meta data in the datamodel
« on: June 02, 2014, 11:07:32 pm »
Hi,
I there anyway to keep additional meta data in the datamodel and what is the best way to do that?
For example in the grid I have a dropdown column which I populate from DB and show a description property only which maps directly to the grid datamodel.
Each object in the dropdown has a pkey but I am not sure how to store it within the grid and more importantly how to get the pkey when user selects the description from the dropdown.
Thank you as always.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6263
    • View Profile
Re: Additional meta data in the datamodel
« Reply #1 on: June 03, 2014, 12:24:14 pm »
In the grid dataModel, pkey can be stored in a hidden column.

while json data format can be used for the editor.options, pkey can be stored as valueIndx while description as labelIndx.

Please refer to the API:
http://paramquery.com/pro/api#option-column-editor

you might also need to implement editor.getData callback to fetch both pkey and description from the editor.
« Last Edit: June 03, 2014, 12:31:23 pm by paramquery »

stoodin

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 85
    • View Profile
Re: Additional meta data in the datamodel
« Reply #2 on: June 03, 2014, 06:21:47 pm »
Excellent, thanks a lot