jQuery UI Widgets Forums Lists DropDownList Changing field source values

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

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • Changing field source values #32180

    cberube
    Member

    I need to show the Dropbox values mapping depending on the row.userType. Can it be done dynamically from the get go in order to make sure the show the right value mapping. For example here, 2 might mean “N” or “S” depending ot the empType.

    { name: ‘v1’, type: ‘string’, values: { source: empType1.records, value: ‘value’, name: ‘label’ } },
    { name: ‘v1’, type: ‘string’, values: { source: empType2.records, value: ‘value’, name: ‘label’ } },

    var empType1val = [
    { value: 5, label: “E” },
    { value: 4, label: “K” },
    { value: 3, label: “S” },
    { value: 2, label: “N” },
    { value: 1, label: “U” }
    ];

    var empType2val = [
    { value: 3, label: “E” },
    { value: 2, label: “S” },
    { value: 1, label: “U” }
    ];

    Changing field source values #32368

    Dimitar
    Participant

    Hello cberube,

    Could you, please, tell us how and when is the value of source determined? This may give a clue to the issue’s solution.

    Best Regards,
    Dimitar

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

    Changing field source values #32407

    cberube
    Member

    My source is an XML file.

    The data mapping is done as suggested:
    var dataAdapter = new $.jqx.dataAdapter(source, {
    downloadComplete: function (data, status, xhr) {
    // get the data from the XML and push it into Array.
    var records = $(source.root + ” ” + source.record, data);
    var dataToReturn = [];
    for (var i = 0; i < records.length; i++) {
    var ejc = $(records[i]).attr('EJC');
    var grp = $(records[i]).attr('GRP');

    As for the dropdownList. Right now, I am using the solutions provided another post using the initeditor callback to override the default values.

    initeditor: function (row, value, editor) {
    var EJC = $('#empGrid').jqxGrid('getcellvalue', row, "EJC");
    if (prt.emp.isEmpType2(EJC)) {
    editor.jqxDropDownList({ source: empType2.records, displayMember: 'label', valueMember: 'value' });
    }
    }

    I do all other fields mapping and calculations using the bindingcomplete event. This is a bit slow and I am trying to optimize it right now.

    Thanks,

    Changing field source values #32559

    Dimitar
    Participant

    Hi cberube,

    I understand that you wish each row’s dropdown list editor to have its available values based on the row. Please provide us with your entire page, including your grid initialization.

    Best Regards,
    Dimitar

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

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

You must be logged in to reply to this topic.