Author Topic: Select Editor not showing labelIndex text  (Read 2272 times)

npdev13

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 21
    • View Profile
Select Editor not showing labelIndex text
« 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

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Select Editor not showing labelIndex text
« Reply #1 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/

npdev13

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: Select Editor not showing labelIndex text
« Reply #2 on: August 02, 2019, 07:17:25 pm »
Thanks, You're Great! It is working