ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: npdev13 on August 02, 2019, 05:49:31 pm

Title: Select Editor not showing labelIndex text
Post by: npdev13 on August 02, 2019, 05:49:31 pm
Hello,

In Grid I have one select editor (dropdown) and that dropdown.

http://jsfiddle.net/m8j7udte/

Dropdown bind with Options list something like as below:
     pq.ItemTypeList = [
                { id: "1", name: "Item Type1", "pq_selected": true },
                { id: "2", name: "Item Type2" },
                { id: "3", name: "Item Type3" },
            ];

I have bind it with one column like

 {
                    title: "Item Type", dataIndx: "itemtypeid", width: 200, sortable: false,
                    editor: {
                        type: "select",
                        labelIndx: "name",
                        valueIndx: "id",
                        prepend: { "Default": "Default" },
                        options: pq.ItemTypeList,
                    },
                    render: function (ui) {
                        var cellData = ui.cellData;
                        if (cellData != null && cellData != "") {
                            return ui.cellData;
                        }
                        else {

                            ui.rowData.itemtype = "Default";
                            return "Default";
                        }
                    }
                },
                 

In the DB I am saving Value field so for example "1", "2" etc... on UI it not showing selected label text and it showing "1" instead of "Item Type1"

Can you please tell me what is issue in configuration?

Thanks
Title: Re: Select Editor not showing labelIndex text
Post by: paramvir on August 02, 2019, 06:34:52 pm
Need correction:

Code: [Select]
                    editor: {
                        type: "select",
                        labelIndx: "name",
                        valueIndx: "id",
                        prepend: { "": "Default" },
                        options: pq.ItemTypeList,
                    },
                    render: function (ui) {
                        var cellData = ui.cellData;
                        if (cellData != null && cellData != "") {
                            return pq.ItemTypeList.find(function(item){
                            return item.id == cellData;
                            }).name
                        }
                        else {

                            ui.rowData.itemtype = "Default";
                            return "Default";
                        }
                    }

http://jsfiddle.net/y0tpu2vd/
Title: Re: Select Editor not showing labelIndex text
Post by: npdev13 on August 02, 2019, 07:17:25 pm
Thanks, You're Great! It is working