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
Hi,
I replied to a posting that was answered and could not figure out how to un-answer it to make sure Support would look at it so I created this post. Please refer to:
http://www.intersoftpt.com/Community/WebGrid/How-do-I-set-multiple-values-for-an-Unbound-WebCombo-in-a-WebGrid-to-show-up-in-the-DropDown/
How do I filter the List Items in the Unbound WebCombo?
I tried to use the WebCombo Client Side Method SetAdditionalFilters in the WebGrid ClientSideEvent OnEnterEditMode based on a value in the row but on the first time a row
is selected it does not filter and on subsequent rows selected nothing is in the Drop Down List.
I modified the code Hans supplied with:
<ClientSideEvents OnEnterEditMode="WebGrid1_OnEnterEditMode" />
<script language="javascript" type="text/javascript"> function WebGrid1_OnEnterEditMode(controlId, TableName, editObject) { var _WebGrid = ISGetObject(controlId); var _WebGridCell = editObject.ToCellObject(); if (_WebGridCell.Name == "Roles") { var _WebCombo = editObject.element; var FilterValue_String ; var EmployeeID_String = _WebGridCell.Row.GetCell("EmployeeID").Value if (true) { switch (EmployeeID_String) { case "1": FilterValue_String = "1"; break; default: FilterValue_String = "2"; } _WebCombo.SetAdditionalFilters("[RoleId] = " + FilterValue_String); } else { switch (EmployeeID_String) { case "1": FilterValue_String = "Research Staff"; break; default: FilterValue_String = "Research Manager"; } _WebCombo.SetAdditionalFilters("[RoleName] = " + "'" + FilterValue_String + "'"); } _WebCombo.SetText(_WebGridCell.Text, true); } return true; } </script>
Please see attached screenshots and code.
Thanks,
Doug
Hello,
Is your server still having problems? (Other people are getting responses.)
Since you already replied about server problems, does that mean I dropped out of your To Do queue?
Have you done any investigation prior to this reply?
Please respond.
Hello,Yes, currently we are still investigating your issue to find the right solution.I am sorry for the late response.Regards,Hans.
function WebGrid1_OnEnterEditMode(controlId, TableName, editObject) { var _WebGrid = ISGetObject(controlId); var _WebGridCell = editObject.ToCellObject(); if (_WebGridCell.Name == "Roles") { var _WebCombo = editObject.element; //So I can get WebCombo rows _WebCombo.ShowDropDown(); window.setTimeout(function () { //To get WebCombo value var WebComboValue = _WebCombo.Values[0].Value; //To get WebCombo rows var WebComboRows = _WebCombo.GetRows(); var RowsLength = WebComboRows.length; for (i = 0; i < RowsLength; i++) { var Row = WebComboRows[i]; var RowValue = Row.Value; if (RowValue != WebComboValue) Row.RowElement.style.display = "none"; } //To hide the dropdown again _WebCombo.HideDropDown(); }, 500); } return true; }
I attached the modified sample as well. Hope this helps. Thank you.Regards,Hans.
Hi Hans,
I will try it and let you know the results.
One problem with the code is eventually with different values it displays nothing which can be corrected by setting the values to display with style.display = "inline".
if (RowValue != WebComboValue) { Row.RowElement.style.display = "none"; } else { Row.RowElement.style.display = "inline"; }
Now the next step is I want to filter based on the [Roles].[DepartmentId] column.
1. It probably needs to be added to the SqlDataSource2 SelectCommand.
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:SqlSampleConnection %>" SelectCommand="SELECT [RoleId], [RoleName], [DepartmentId] FROM [Roles]"></asp:SqlDataSource>
2. I do not want [Roles].[DepartmentId] to be displayed as a column in the DropDown
How do I reference the [Roles].[DepartmentId] Value in the OnEnterEditMode Event so I can Filter by it?
That is working for me.
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