jQWidgets Forums

jQuery UI Widgets Forums Grid editor.dropDownList placeHolder issue

This topic contains 2 replies, has 2 voices, and was last updated by  Justintkw 9 years, 1 month ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author

  • Justintkw
    Participant

    Hi:

    I have the following dropdown column:

    {
                        text: 'Final Grade', dataField: 'FinalGrade', columntype: 'dropdownlist', cellsalign: 'center', width: 85,
                        cellsrenderer: function (row, columnfield, value, defaulthtml, columnproperties) {
                            return '<div class="griddiv">' + value + '<div>';
                        },
                        initeditor: function (row, cellvalue, editor) {
                            editor.jqxDropDownList({ source: CSFinalGradeSchemeDDLAdapter, displayMember: 'ElementDes', valueMember: 'Element', placeHolder: "Select..."});
                        }
    }

    CSFinalGradeSchemeDDLAdapter is generated as follows:

            var CSFinalGradeSchemeDDLData = CSGradeSchemeList;
            var CSFinalGradeSchemeDDLSource =
            {
                datatype: "json",
                datafields: [
                    { name: 'ElementDes' },
                    { name: 'Element' }
                ],
                id: 'Element',
                localdata: CSFinalGradeSchemeDDLData
            };
            var CSFinalGradeSchemeDDLAdapter = new $.jqx.dataAdapter(CSFinalGradeSchemeDDLSource, { autoBind: true, async: false });

    When the column goes into edit mode, the values show up in the dropdownlist as expected, EXCEPT. . . The placeholder just isn’t there.

    In order for me to get a blank item, I have to work around and convert the source into an array instead, like so:

            var AlternateSourceForCSFinalGradeDDL = [];
            AlternateSourceForCSFinalGradeDDL[0] = "";
            for (var i = 0; i < CSFinalGradeSchemeDDLAdapter.records.length; i++) {
                AlternateSourceForCSFinalGradeDDL[i+1] = CSFinalGradeSchemeDDLAdapter.records[i]['Element'];
            }

    Then, bind the dropDownList to the array instead. This works, but is not ideal. I am wondering why the placeholder is not showing up as intended. I am using the latest version of the control.

    Thank you for your help.


    Peter Stoev
    Keymaster

    Hi Justintkw,

    The widget displays a place holder only when it’s selection is empty which by default isn’t. In addition, I think you should use createeditor which is called once, not initeditor which is called each time a cell goes into edit mode.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/


    Justintkw
    Participant

    Thanks, Peter. That was helpful.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.