jQuery UI Widgets › Forums › Grid › Grid Dropdown Filter Values
This topic contains 4 replies, has 2 voices, and was last updated by Dave_1 9 years, 2 months ago.
-
Author
-
I want to dynamically load different drop down values for different rows depending on another column value , during grid filter.
How do i go about it.Hi Dave_1,
Please try this scenario:
Use an array about your filter items.
On filter check some conditions and modify your array. Then apply the new filter items with refreshfilterrow.Here is a simplified demo.
Best Regards,
Ivailo IvanovjQWidgets Team
http://www.jqwidgets.com$(document).ready(function () { var data = generatedata(500); var source = { localdata: data, datafields: [ { name: 'name', type: 'string' }, { name: 'productname', type: 'string' } ], datatype: "array" }; var dataAdapter = new $.jqx.dataAdapter(source); var items = new Array(); items.push(data[0].name); items.push(data[1].name); items.push(data[2].name); items.push(data[3].name); items.push(data[4].name); var items2 = new Array(); items2 = ['All']; function filteritems(){ return items; } function filteritems2(){ return items; } $("#jqxgrid").jqxGrid( { width: 600, source: dataAdapter, showfilterrow: true, filterable: true, columns: [ { text: 'Name', filtertype: 'list', filteritems: items, datafield: 'name', width: 200 }, { text: 'Product', filtertype: 'list', filteritems: items2, datafield: 'productname'} ] }); $("#jqxgrid").on("filter", function (event) { var filterGroups1 = grid.jqxGrid('getfilterinformation'); for (var k = 0; k < filterGroups1.length; k++) { var filterGroup1 = filterGroups1[k]; var ClmName1= filterGroup1.filtercolumntext var filters1 = filterGroup1.filter.getfilters(); for (var l = 0; l < filters1.length; l++) { var ClmValue1=filters1[l].value; } if(ClmValue1=="Name"){ fillProducts(ClmValue1); //sending filter column value to a function for getting values for Product dropdownlist } } }); });
i have modified the code accordingly,
i am calling a function “fillProducts” where i am taking a array and accoding to “Name” Field Value , i want to show the dropdownlist.this is working too.. but, i am facing problem when, i want to show the custom product list for each “Name”.
Hi Dave_1,
Please send your full code(with fillProducts function etc.) in jsEditor for better analyze.
Also give a bit more explanation of the problem, and the behavior that you need to realize.Best Regards,
Ivailo IvanovjQWidgets Team
http://www.jqwidgets.comthanks Ivailo i forgot to add filters combobox.
Its working now -
AuthorPosts
You must be logged in to reply to this topic.