Author Topic: editor select box filled on each grid line  (Read 3132 times)

daverene

  • Newbie
  • *
  • Posts: 23
    • View Profile
editor select box filled on each grid line
« on: April 05, 2017, 04:10:10 am »
I have a select box in a row which needs to be filled with data depending on what value another record has in the same row. I have the following colModel for this field and it does not appear to work.

title: "Event", dataType: "string", dataIndx: "Event", minWidth: 70, maxWidth: 70, hidden: false, editable: function (ui) { if (ui.rowData.Update == 1) { return true; } else { return false; } },
                     filter: {
                         type: "select",
                         condition: 'equal',
                         prepend: { '': '-ALL-' },
                         valueIndx: "Event",
                         labelIndx: "Event",
                         listeners: ['change']
                     },
                     editor: {
                         type: 'select',
                         valueIndx: "EventNo",
                         labelIndx: "EventNo",
                         options: function (ui) {
                             var grid = this,
                                 column;
                           
                             $.getJSON("http://projectcontrols/TimeLinkWebservice/TimeLinkWebservice.asmx/JSON_GetEvents?WorkOrderNo=" + ui.rowData.WorkOrderNumber, function (response) {
                                 column = grid.getColumn({ dataIndx: 'Event' });
                                 column.editor.options = response;
                             });
                         }

                     }

daverene

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: editor select box filled on each grid line
« Reply #1 on: April 06, 2017, 06:37:59 am »
my url returns the following data

[{"ID":0,"EventNo":""},{"ID":71,"EventNo":"34"},{"ID":259,"EventNo":"54"},{"ID":262,"EventNo":"57"},{"ID":264,"EventNo":"59"},{"ID":265,"EventNo":"60"},{"ID":266,"EventNo":"60"},{"ID":10396,"EventNo":"74"}]


why would this not appear in the select editor? How to I insert this into the sell correctly?

daverene

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: editor select box filled on each grid line
« Reply #2 on: April 07, 2017, 09:10:00 am »
Do you have an answer on how to make a select fill depending an what another record is in the same row?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: editor select box filled on each grid line
« Reply #3 on: April 07, 2017, 09:37:56 am »
editor options is a synchronous method, it can't be used to make async calls.

I would suggest to cache all the options data and return options synchronously similar to this example:

https://paramquery.com/pro/demos/cascade_select