ParamQuery grid support forum

General Category => ParamQuery Pro Evaluation Support => Topic started by: Anton on June 15, 2017, 02:58:40 pm

Title: Re: How I can use pqselect as custom editor?
Post by: Anton 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.
Title: Re: How I can use pqselect as custom editor?
Post by: Anton 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] };
            }
        }
    }