jQWidgets Forums

jQuery UI Widgets Forums General Discussions Lists DropDownList Dropdownlist inside a editor grid

Tagged: 

This topic contains 8 replies, has 2 voices, and was last updated by  Peter Stoev 12 years, 1 month ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
  • Dropdownlist inside a editor grid #22762

    Hello,

    I have a dropdownlist builded with the editor, i need this dropdownlist being the one to be catched by a form. To pass data to the form i need to change the attribute
    name of the dropdown but i don’t know how to do. The changing provide a control to understand if the editor is the first time that visualize the dropdown.

     createeditor: function (row, column, editor) {
    console.log(editor);
    editor.jqxDropDownList({source: source1, width: '150px', height: '30', selectedIndex: 0, theme: "metro"});
    editor.attr('name', 'data[Categories][newCategory]');
    editor.on('change', function (event){
    if (changing) {
    //console.log();
    //console.log(jQuery('#newcate1').jqxDropDownList('getSelectedItem').value);
    //jQuery('#newcate1').jqxDropDownList('checkItem', editor.jqxDropDownList('getSelectedItem').value);
    jQuery('#firstsubmit').click();
    } else {
    changing = true;
    }
    });
    },

    Alternativelly in the comment i tried to modify another dropdown external the grid but inside a form with the exact attribute name with functions like val,SelectItem, checkedItem, but they do not work

    Dropdownlist inside a editor grid #22764

    Peter Stoev
    Keymaster

    Hi,

    Please, look at this sample: http://www.jqwidgets.com/jquery-widgets-demo/demos/php/dropdownlist.htm?web. The DropDownList is in a Form and its value is submitted.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Dropdownlist inside a editor grid #22766

    The problem is not to submit a dropdown but to submit adropdown in editor. I know how to submit form and dropdown in other case.

    Thanks

    Dropdownlist inside a editor grid #22768

    Peter Stoev
    Keymaster

    Hi,

    1. If the Grid is in a Form and you have set the Editor’s name, its value should be submitted as it is a Child of the Grid.
    2. Another way is to select the editor by ID or Name outside the Grid and fill it with the selected value.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Dropdownlist inside a editor grid #22769

    Ok, i get close, how can i set the name of an editor?

    Because

    editor.attr(‘name’, ‘MyName’);

    do not work.

    Dropdownlist inside a editor grid #22770

    I see that the name of the input is

    name=”dropdownlisteditorgridcategory_id” , i would like to set it as my name data[Categories][NewCategory];

    Dropdownlist inside a editor grid #22772

    Peter Stoev
    Keymaster

    Hi,

    If you want to change the inner Input’s “name” attribute, then select it with jQuery and set its “name”.

     Example: editor.find('input').attr('name', 'MyName');

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Dropdownlist inside a editor grid #22773

    I could change the input value but the beahviuor is different inside and outside the grid. Indeed inside the grid do not change the input value to newvalue selected in dropdown whereas externally it change. How can i get standard beahviuor.

    Dropdownlist inside a editor grid #22774

    Peter Stoev
    Keymaster

    Hi,

    The simplest solution would be to bind to the editor’s change event and update a hidden input on your Form.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.