jQWidgets Forums

jQuery UI Widgets Forums Grid Unable to set in Grid, the selected value from Dropdownlist

This topic contains 4 replies, has 2 voices, and was last updated by  Keshavan 12 years, 3 months ago.

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

  • Keshavan
    Participant

    Hi,

    I am unable to set the selected value from DropdownList (1st cell of every row) in to Grid.

    I am able to display Dropdownlist values properly and there are no other issues. I have used ‘createeditor’ in Grid and should set selected value accordingly. Please also let me know if there are any issues in ‘Main data source” code below.

    Thanks,

    Keshavan

    Foreign source.
    ——————

    var source =
    {
    datatype: “json”,
    datafields:
    [
    { name: ‘GroupCompanyId’ },
    { name: ‘GroupName’ },
    ],
    id: ‘GroupCompanyId’,
    url: ‘GroupCompany/GetSemiGroupCompanies’,
    async: false
    }
    var dataAdapater1 = new $.jqx.dataAdapter(source, { autoBind: true })

    Main data source
    ———————
    var source1 =
    {
    datatype: “json”,
    datafields:
    [
    { name: ‘CompanyId’ },
    { name: ‘Group’, value: ‘GroupCompanyId’, values: { source: dataAdapater1.records,
    value: ‘GroupCompanyId’, name: ‘GroupName’
    }
    },
    { name: ‘CompanyName’ },
    { name: ‘Unit’ },
    { name: ‘Phone’ },
    { name: ‘EmailId’ },
    { name: ‘AddressLine1’ },
    { name: ‘AddressLine2’ },
    { name: ‘Zip’ },
    { name: ‘Country’ },
    { name: ‘Culture’ },
    { name: ‘Miscellaneous1’ },
    { name: ‘Miscellaneous2’ },
    { name: ‘Miscellaneous3’ },
    /* { name: ‘GroupCompany.GroupCompanyId’ },
    { name: ‘GroupCompany.GroupName’ },
    { name: ‘GroupCompany.Miscellaneous1’ },
    { name: ‘GroupCompany.Country’ },
    { name: ‘GroupCompany.Culture’ },*/
    ],
    id: ‘CompanyId’,

    var dataAdapater = new $.jqx.dataAdapter(source1);

    Grid Initialize
    —————-

    // initialize jqxGrid../../JqWidgets/index.htm
    $(“#jqxgrid”).jqxGrid(
    {
    width: 950,
    height: 350,
    source: dataAdapater,
    theme: ‘ui-smoothness’,
    editable: true,
    editmode: ‘selectedcell’,
    rowdetails: true,
    rowsheight: 20,
    columns:
    [
    {
    text: ‘Group List’, datafield: ‘GroupCompanyId’, columntype: ‘dropdownlist’, displayfield:
    ‘GroupName’, datafield: ‘GroupCompanyId’, width: 200,
    createeditor: function (row, cellvalue, editor)
    {
    editor.jqxDropDownList
    ({ source: dataAdapater1, displayMember: ‘GroupName’,
    valueMember: ‘GroupCompanyId’
    });

    }
    },
    { text: ‘Company’, datafield: ‘CompanyName’, width: 215 },
    { text: ‘(Company)Unit’, datafield: ‘Unit’, width: 80 },
    { text: ‘(Contact) Phone’, datafield: ‘Phone’, width: 180 },
    { text: ‘(Contact)Email ‘, datafield: ‘EmailId’, width: 180 },
    { text: ‘Address ‘, datafield: ‘AddressLine1’, width: 100 },
    { text: ‘ ‘, datafield: ‘AddressLine2’, width: 100 },
    { text: ‘Zip’, datafield: ‘Zip’, width: 80 },
    { text: ‘Country’, datafield: ‘Country’, width: 80 },
    { text: ‘Culture’, datafield: ‘Culture’, width: 80 },
    { text: ‘Other’, datafield: ‘Miscellaneous1’, width: 80 },
    { text: ‘ ‘, datafield: ‘Miscellaneous2’, width: 80 },
    { text: ‘ ‘, datafield: ‘Miscellaneous3’, width: 80 },
    ]
    });


    Keshavan
    Participant

    Hi,

    I have solved the issue mentioned,

    When i load the Grid, the ‘dropdowlist’ doesn’t DISPLAY the ‘GroupName’ in the ‘GroupColumnId’ column.

    Insert mode is workng fine and i saw the record with all values in table. I checked server code for fetching data and is perfect.

    Please help, the code is same as pasted earlier.

    Thanks,

    Keshavan


    Keshavan
    Participant

    Hi,

    I have solved the earlier issue mentioned (1st post ) , there is some new issue as below.

    When i load the Grid, the ‘dropdowlist’ doesn’t DISPLAY the ‘GroupName’ in the ‘GroupColumnId’ column.

    Insert mode is workng fine and i saw the record with all values in table. I checked server code for fetching data and is perfect.

    Please help, the code is same as pasted earlier.

    Thanks,

    Keshavan


    Dimitar
    Participant

    Hello Keshavan,

    You should implement the initeditor callback function for your dropdownlist editor. Here is an excerpt from the documentation about initeditor:

    initeditor – sets a custom function which is called when the cells editor is opened. The Grid passes 3 parameters to it – row index, cell value and the editor element. The function can be used for adding some custom parameters to the editor.

    { text: 'Quantity', datafield: 'quantity', width: 70, cellsalign: 'right', columntype: 'numberinput',
    initeditor: function (row, cellvalue, editor) {
    editor.jqxNumberInput({ decimalDigits: 0, digits: 3 });
    }
    }

    Best Regards,
    Dimitar

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


    Keshavan
    Participant

    Hi Dimitar,

    Thanks for the clarifcation, i will implement the solution accordingly.

    Best Regards,

    Keshavan

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

You must be logged in to reply to this topic.