jQuery UI Widgets Forums Grid Grid Editing using DropDown list json

This topic contains 4 replies, has 2 voices, and was last updated by  Peter Stoev 11 years, 8 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • Grid Editing using DropDown list json #8921

    DavidSimmons
    Participant

    Do you have an example, editing a grid column using a dropdown list from json?

    Grid Editing using DropDown list json #8929

    Peter Stoev
    Keymaster

    Hi David,

    We do not have such sample. All examples that we have are available online: jqxGrid Demos. The dropdownlist editor is populated automatically using the column’s unique cell values. If you want to override this, you can use the column’s createeditor function which is called when the editor is initialized. For more information about that, please take a look at the help documentation about the ‘columns’ property here: jquery-grid-api.htm.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Grid Editing using DropDown list json #8940

    DavidSimmons
    Participant

    So can the dataSource be a JSON, id, value list

    { text: ‘Product’, columntype: ‘dropdownlist’, datafield: ‘productname’, width: 177,
    createeditor: function (row, cellvalue, editor) {
    var dataSource = JSON;
    editor.jqxDropDownList({source: dataSource });
    }
    }

    Grid Editing using DropDown list json #9000

    DavidSimmons
    Participant

    I have this column that I am trying to create a editor. The value of PriceType is a int and In my standalone test this works fine, I alert the index and value. When I am working in the grid the drop down does not display the value, but only the index. Here is my test code…

    { text: ‘PriceType’, datafield: ‘PriceType’, columntype: ‘dropdownlist’, width: 200, editable: true,
    createeditor: function (row, cellvalue, editor) {
    var source = {
    datatype: “json”,
    datafields: [
    { name: ‘Index’ },
    { name: ‘Value’ }
    ],
    id: ‘id’,
    url: ‘CompanyPriceTypeJSON.php’,
    async: false
    };
    var dataAdapter = new $.jqx.dataAdapter(source);
    editor.jqxComboBox({ selectedIndex: cellvalue, source: dataAdapter, displayMember: “Value”, valueMember: “Index”, width: 200, height: 25, theme: theme });
    editor.bind(‘select’, function (event) {
    if (event.args) {
    var item = event.args.item;
    if (item) {
    return item.value;
    }
    }
    });

    }
    },

    Grid Editing using DropDown list json #9012

    Peter Stoev
    Keymaster

    Hi David,

    We still do not have ComboBox editor. It will be available in jQWidgets 2.5 which is expected in the second half of this month. Because of that, your code will not work with the current version of jqxGrid. We will also add functionality to update the cell editor’s value before it is saved in the Grid. Looks like that’s what you try to do in your scenario.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.