iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
Hello InterSoft,
I need to add filter to grid FilteredColumns collection in javascript. If filter is a simple textbox then code below works fine.
filter.FilterType = "EqualTo";filter.FilterText = "xyz";grid.RootTable.FilteredColumns.Add(filter); How to do the same functionality for a filter in a grid which is a valuelist (dropdown)? I assume that I need to point from cell to combo and than use combo.SetAdditionalFilters() function. What is a code to do it? I am doing it from cell_click event so I know columnId,cellId ...Thank youThank you
filter.FilterText = "xyz";
grid.RootTable.FilteredColumns.Add(filter);
How to do the same functionality for a filter in a grid which is a valuelist (dropdown)? I assume that I need to point from cell to combo and than use combo.SetAdditionalFilters() function. What is a code to do it? I am doing it from cell_click event so I know columnId,cellId ...
Thank you
In order to show the filter text for dropdownlist when you are filtering programmatically you will need to set the filter text manually in the corresponding filter row cell.
Here is a snippet for such scenario, the value of the filter is 2 while the filter text is Interest 1 and the filtered cell is the fourth cell in the WebGrid:
function FilterGrid() { var grid = ISGetObject("wgTest"); var newFilter = new WebGridFilter(); // create new Filter configuration newFilter.ColumnMember = "Interest"; newFilter.FilterType = "EqualTo"; newFilter.FilterText = "2"; grid.RootTable.FilteredColumns.Add(newFilter); grid.RootTable.FilteredColumns.Add(newFilter2); grid.RootTable.UpdateUI(); grid.Refresh(); // apply changes var colHeaderRows = grid.RootTable.GetElement(WG40.COLHEADER, WG40.HTMLROW).getElementsByTagName("tr"); for(var i = 0; i < colHeaderRows.length; i++) { var colHeader = colHeaderRows[i]; if (colHeader.getAttribute("type") == "FilterRow") { colHeader.getElementsByTagName("td")[4].getElementsByTagName("span")[0].innerHTML = "Interest 1"; } }}
From my test, the code will be the same, adding WebGrid filter to FilteredColumns collection. However, if you are using WebValueList, the filter text will be the value of the DataValueField you assign in the WebValueList.
I have applied filter to a valuelist(dropdown). Even filter works properly, it is not selected item in a dropdown filter? How to make it selected item?
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname