jQuery UI Widgets › Forums › Grid › Combobox in Grid
Tagged: combobox editor
This topic contains 4 replies, has 2 voices, and was last updated by Peter Stoev 11 years, 11 months ago.
-
AuthorCombobox in Grid Posts
-
Hi,
I need help in binding combobox. Here I’ve to get the items to combobox depending on the values selected in another combobox. Suppose I’ve a date column and a combobox column. When I select a date in the row, the data which is related to selected date should be binded to combobox. Can anyone help me how to achieve it?
Regards,
SyaiHi Syai,
In the “initeditor” callback function of the ComboBox column, you can use the “getrowdata” to get the selected row’s data. That data will contain the data from your Date column, too. Then use can set the “initeditor” to update the source of the ComboBox editor.
{ text: 'Quantity', datafield: 'quantity', width: 200, cellsalign: 'right', columntype: 'combobox', initeditor: function (row, cellvalue, editor) { editor.ComboBox({ source: newDataAdapter }); }}
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter,
Thanks for the reply. Can you please help me regarding how to send the selected row data to server so that I can filter the combobox data with the date while getting from database itself. I’m not much aware of sending the selected row data as parameter to server.
Regards,
SyaiHi,
Can anyone help me on this. Here I’m trying to pass selected row value to server through source but the value it is passing the value as null. I need to assign the value when the cell value of the row is changed. So I’m calling the dataadapter in initeditor. Below is the piece of code I’ve used in source.
var moduleSource = { datatype: "json", datafields: [ { name: 'Name' }, { name: 'Id' }, { name: 'StartDate' }, { name: 'EndDate' } ], data: { 'SelectedDate': _selServiceDate }, id: 'CourseModuleId', url: '@Url.Action("GetModulesOnCourseData", "Controller")' };//INITIALIZE THE DATA ADAPTER FOR THE MODULE SOURCEvar moduleDataAdapter = new $.jqx.dataAdapter(courseModuleSource, { autoBind: false, async: false});
Here ” _selServiceDate” is the date I’m getting on selecting the combobox of the row from selected row. This value is not getting sent to the server side.
Regards,
SyaiHi,
I am not sure what moduleAdapter stands for, but if you set the ComboBox’s property to point to that adapter in the “initeditor” callback, the widget will call the dataAdapter’s dataBind method and an Ajax call to the server will be made. Please, note that “initeditor” is called each time a cell editor is opened.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.