Author Topic: Re: How I can use pqselect as custom editor?  (Read 2223 times)

Anton

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: How I can use pqselect as custom editor?
« on: June 15, 2017, 02:58:40 pm »
Quote
pqSelect is used as an inline editor in this example: http://paramquery.com/pro/demos/editing_custom in "Shipping Via" column.

"Shipping Via" column does not display corresponding text after loading json having field "ShipViaId" with value being set:

[{
      "rowID": 1,
      "ShipViaId": "UP"
      "OrderID": 10248,
      "CustomerName": "Vins et alcools Chevalier",
      "ProductName": "Queso Cabrales",
      "UnitPrice": 14.0000,
      "Quantity": 12,
      "OrderDate": "07/04/1996",
      "RequiredDate": "08/01/1996",
      "Freight": 32.3800,
      "ShipName": "Vins et alcools Chevalier",
      "ShippedDate": "07/16/1996",
      "ShipAddress": "59 rue de l'Abbaye",
      "ShipCity": "Reims",
      "ShipRegion": null,
      "ShipPostalCode": "51100",
      "ShipCountry": "France",
    }]


There is no example with this feature working.

The text appears  after entering and exiting edit mode.
« Last Edit: June 15, 2017, 04:45:48 pm by Anton »

Anton

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: How I can use pqselect as custom editor?
« Reply #1 on: June 15, 2017, 05:02:44 pm »
Hotfix for JSON data case using cell render:

function RenderEditorSelectCol (ui) {
        var ed = ui.column.editor;
        var val = ui.rowData[ed.mapIndices[ed.valueIndx]];
        for (var k = 0; k < ed.options.length; k++) {
            if (ed.options[k][ed.valueIndx] == val) {
                return { text: ed.options[k][ed.labelIndx] };
            }
        }
    }