jQWidgets Forums
jQuery UI Widgets › Forums › General Discussions › Lists › DropDownList › Dropdownlist inside a editor grid
Tagged: DropDownList
This topic contains 8 replies, has 2 voices, and was last updated by Peter Stoev 12 years, 1 month ago.
-
Author
-
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
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 StoevjQWidgets Team
http://www.jqwidgets.comThe 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
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 StoevjQWidgets Team
http://www.jqwidgets.comOk, i get close, how can i set the name of an editor?
Because
editor.attr(‘name’, ‘MyName’);
do not work.
I see that the name of the input is
name=”dropdownlisteditorgridcategory_id” , i would like to set it as my name data[Categories][NewCategory];
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 StoevjQWidgets Team
http://www.jqwidgets.comI 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.
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 StoevjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.