Title: datagrid, filter row and combobox
Post by: Fabrice on September 17, 2015, 08:34:42 AM
I write this function to fill a combobox with datagrid content in OnLoadSuccess() event : var rows = $(dd).datagrid('getData'); $.each(filters, function (num_filter, filter) { if (filter.type == 'combobox') { var menu = [{ value: '', text: 'All' }]; var found; $.each(rows.rows, function (num_data, row) { found = false; $.each(menu, function (num_menu, item_menu) { if (item_menu.text == row[filter.field]) { found = true; return false; } }); if (found == false) { menu.push({ value: row[filter.field], text: row[filter.field] }); } }); var cc = $(dd).datagrid('getFilterComponent',filter.field); if (cc != undefined) { cc.combobox('loadData', menu); } } });
My problem is the getData method return filtered datas, then the first time i open combobox all is right, but the second time (after filering) only 'All' and my selection appears in the combobox! is-it possible to get all datas (filtered and not filtered) to correctly fill my combobox?
Title: Re: datagrid, filter row and combobox
Post by: jarry on September 18, 2015, 01:00:51 AM
Please try the code below to get the datagrid data. var dg = $(dd); var state = dg.data('datagrid'); var rows = state.filterSource || state.data;
Title: Re: datagrid, filter row and combobox
Post by: Fabrice on September 18, 2015, 06:22:03 AM
Perfect, thx!
|