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
Is there an way that I can tell if a filter has been applied to the grid? I need to put up a message to the user when a filter has been added (whether it was done via the filter bar or programmatically). I need to duplicate the "Filtered" icon that is already displayed in the status area.
thanks
... I have a page where the user can 1) go directly to the grid page unfiltered or 2) go to the gird via a filter (set programically). In this case neither of the client events runs. What I need to do is to duplicate the Filtered/Unfiltered message that displays in the status bar. I need to know at anytime what the status of the filter state is. Users don't look at the status bar so I need a way to tell the user via a RED MESSGE at top of grid, the filter status. Is this possible?
I have a page where the user can 1) go directly to the grid page unfiltered or 2) go to the gird via a filter (set programically). In this case neither of the client events runs. What I need to do is to duplicate the Filtered/Unfiltered message that displays in the status bar. I need to know at anytime what the status of the filter state is. Users don't look at the status bar so I need a way to tell the user via a RED MESSGE at top of grid, the filter status. Is this possible?
I created a simple sample of WebGrid based on Hans's sample. The grid shows Customers data from Northwind.mdb file. Filtered columns are programmatically added during PrepareDataBinding server-side event in order to emulate scenario 1 and scenario 2 (as shown in the above quoted paragraph).
I’m using OnAfterInitialize client-side event of WebGrid to get the filter state of WebGrid which can't be handled by either OnColumnFilter or OnAfterResponseProcess event. This event invokes ShowFilterInformation() JavaScript function which will display filter information in a text area element.
function WebGrid1_OnAfterInitialize(controlId) { var WebGrid1 = ISGetObject(controlId); ShowFilterInformation(WebGrid1); return true; } function ShowFilterInformation(controlId) { var textArea1 = document.getElementById("textArea1"); if (controlId.RootTable.FilteredColumns.length > 0) { textArea1.value = "WebGrid1 is filtered" + "\n" + "FilteredColumns detail information:" + "\n"; for (var i = 0; i < controlId.RootTable.FilteredColumns.length; i++) { var filteredColumns = controlId.RootTable.FilteredColumns[i]; textArea1.value += "Column " + filteredColumns.ColumnMember.toString() + " is " + filteredColumns.FilterType.toString() + " " + filteredColumns.FilterText.toString() + "\n"; } } else textArea1.value = "WebGrid1 is not filtered"; return true; }
Last, simply do the same in OnAfterResponseProcess client-side event to show filter information when user interacts from client-side.
Please have the attached sample file evaluated on your end and let us hear whether this helps or not.
Hello,Thank you for the question.To know/check whether the filter has been applied to the WebGrid, you could use OnColumnFilter or and OnAfterResponseProcess client side event.Here’s the example snippet code regarding the client side event:
function WebGrid1_OnAfterResponseProcess(controlId, action, lastRO, xmlRO) { var WebGrid1 = ISGetObject(controlId); alert(action); return true; } function WebGrid1_OnColumnFilter(controlId, tableObject) { var WebGrid1 = ISGetObject(controlId); alert("Column is Filtered"); return true; }
I also attach the example page about how I use/implement the client side event.Please kindly have a review on the page to see result.Hope this helps. Thank you.Regards,Hans.
Hi Hans,
Thanks, is there a way to tell what the filter is? or if its filtered or unfiltered? The OnColumnFilter only runs if you filter via the filter bar or context menu.
Glad to hear the good news.
OnAfterInitialize specifies the client side (JavaScript) function that will be invoked after WebGrid had been initialized; and OnAfterResponseProcess specifies the client side (JavaScript) function that will be invoked after the response action of a request has been performed. For more detail information regarding ClientEvents of WebGrid, please refer to ClientEvents Class Members section in WebGrid documentation.
Should you need further assistance or run into any problems regarding our controls, feel free to post it into our community site. We would be happy to assist you again.
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