jQWidgets Forums

jQuery UI Widgets Forums Grid Adding a row to a grid clears the previous rows combobox

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

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

  • mmclaughlin710
    Participant

    I have a simple data grid and have added a combox column to it. The combobox has a local data set. When I a row the first time it works fine. When I add the second row the contents of the combo box on the first row is blanked out. Is there a way to “save” a row on the grid so this does not happen. If I edit the row again it persists and is okay. Thanks,


    admin
    Keymaster

    Hi mmclaughlin710,

    How do you implement a combobox in the Grid? Do you use the approaches shown in our examples with createeditor, initeditor?

    Best regards,
    Peter Stoev

    jQWidgets team
    https://www.jqwidgets.com/


    mmclaughlin710
    Participant

    Peter,

    This is the code for the columns of the grid as well as the datasource etc. Let me know if you need more. I can post the whole code if necessary.

    Thanks,

    columns: [
    { text: ‘Column Name’, datafield: ‘columnname’, width: 200 },
    {
    text: ‘Datatype’, id: ‘jqxComboBox’, datafield: ‘datatype’, displayfield: ‘Datatypes’, columntype: ‘combobox’,
    createeditor: function (row, value, editor) {
    editor.jqxComboBox({ source: datatypesAdapter, displayMember: ‘label’, valueMember: ‘value’ });
    }
    },
    { text: ‘Foreign Table’, datafield: ‘foreigntable’, width: 200 },
    { text: ‘Length’, datafield: ‘columnlength’, width: 180 }
    ]
    });

    var datatypes = [
    {value: “V1”, label: “varchar”},
    {value: “V2”, label: “bigint”},
    {value: “V3”, label: “longtext”},
    {value: “V4”, label: “date”},
    {value: “V5”, label: “datetime”},
    {value: “V6”, label: “int”},
    {value: “V7”, label: “tinyint”},
    {value: “V8”, label: “decimal”},
    {value: “V9”, label: “double”},
    {value: “V10”, label: “text”},
    {value: “V11”, label: “char”},
    {value: “V12”, label: “timestamp”},
    {value: “V13”, label: “set”},
    {value: “V14”, label: “enum”},
    {value: “V15”, label: “longblob”},
    {value: “V16”, label: “mediumtext”},
    {value: “V17”, label: “smallint”},
    {value: “V18”, label: “blob”},
    {value: “V19”, label: “float”},
    {value: “V20”, label: “time”},
    {value: “V21”, label: “bit”},
    {value: “V22”, label: “tinytext”}
    ];

    var datatypesSource =
    {
    datatype: “array”,
    datafields: [
    { name: ‘label’, type: ‘string’ },
    { name: ‘value’, type: ‘string’ }
    ],
    localdata: datatypes
    };
    var datatypesAdapter = new $.jqx.dataAdapter(datatypesSource, {
    autoBind: true
    });

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

You must be logged in to reply to this topic.