Author Topic: column filter for id/text select list shows the id rather than the text  (Read 133 times)

mikep

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 149
    • View Profile
When I use the "Range" option in the column filter, it's showing me the IDs (9,3,1,0) instead of the text. How to show the text (Division, Business Unit...)

                        editor: {
                            type: "select",
                            options: [{ "9": "Division" }, { "3": "Business Unit" }, { "1": "Portfolio" }, { "0": "Other" }],
                        },
                        render: function (ui) {
                            var option = ui.column.editor.options.find(function (obj) {
                                return (obj[ui.cellData] != null);
                            });
                            return option ? option[ui.cellData] : "";
                        }

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6255
    • View Profile
Please copy the column render and editor options to the grid column in filter popup.

Code: [Select]
            filter: {
                crules: [{condition: 'range'}],
                selectGridObj: function (ui) {
                    //reuse column renderer and editor options in filter popup.
                    var col = ui.obj.colModel[0];
                    col.renderLabel = ui.column.render;
                    col.editor = ui.column.editor;
                    col.editable = false;
                }
            },



As a side note, an issue has been found in filter popup whose fix is mentioned in the following post:

column filter popup options are not refreshed after grid data is changed

https://paramquery.com/forum/index.php?topic=4726.msg17299#msg17299
« Last Edit: June 20, 2024, 01:10:28 pm by paramvir »