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
Just wondering is there a client side event that will show the Select Columns menu? I need to have this menu shown when a button is clicked, users have problems with right-clicking on header to bring up context menu and then selecting "Select Coumns". I know!
Thanks
Hello,
You could show the context menu of column header through button click by using ShowContextMenu() function.To use ShowContextMenu() function, you should get the column object first.I’ve made a sample that maybe similar with your current scenario. I use WebGrid (bind to Northwind.mdb and Shippers table) and WebButton in my sample.Then I use OnClientClick client side event of WebButton, to show the context menu.Here’s the snippet code in OnClientClick:
<script language="javascript" type="text/javascript" id="WebButton1_OnClientClick"> function WebButton1_OnClientClick(controlId, parameter) { var WebButton1 = ISGetObject(controlId); var WebGrid1 = ISGetObject("WebGrid1"); // Show context menu for ShipperID column WebGrid1.RootTable.Columns.GetNamedItem("ShipperID").ShowContextMenu(); return true; } </script>
I attached my sample as well, in order to make you easier understand about my sample.
Hope this helps. Thank you.Regards,Hans.
Thanks Hans, but I don't want to show the entire context menu only the Select Columns menu.
I’ve modified my sample by adding WebGrid’s OnColumnContextMenu client side event.On that event, I hide all menu item except “Select Column” menu item.Here’s the snippet OnColumnContextMenu client side event:
function WebGrid1_OnColumnContextMenu(controlId, col, menu, isGroup, location) { var WebGrid1 = ISGetObject(controlId); var menuItemLength = menu.Items.length; for (var i = 0; i < menuItemLength; i++) { var menuItemName = menu.Items[i].Name; if (menuItemName != "mnuSelectColumns") { menu.Items[i].Hide(); } } return true; }
I attached the modified sample as well.
Thank you.Regards,Hans.
Thanks,
But the position of the ContextMenu is still off from an error I reported a while ago based upon the scrollbar location. This is happening with the latest framework. Any fix in the works?
http://www.intersoftpt.com/Community/WebGrid/WebGrid-7-and-Framework-801-error/
I’m really sorry for the inconvenience.But unfortunately, I have yet to get any update from our developer team about this issue.
However I’ll let you know if there is any update for this issue.
Thank you for your understanding.
Regards,Hans.
Hi, Since there is a bug in how the context menu is shown, I need to create my own form to allow users to select from. Is there a way to get all columns associated with the roottable and whether they are visible or not? I tried in the InitializeColumn even but it only shows what is visible. Can this be done client side and server side?
thanks
To get the hidden column value, you could use “HiddenDataMember” column property of WebGrid.I made a sample to get the hidden column value. In my sample, I use Northwind.mdb database and Shipper table.
I set visibility of Phone column to “False”.In ShipperID column, I set HiddenDataMember property to “Phone”.
I use OnRowSelect client side event to get the hidden column value, then set the value to TextBox
Here’s the snippet code in OnRowSelect client side event:
function WebGrid1_OnRowSelect(controlId, tblName, rowIndex, rowEl) { var WebGrid1 = ISGetObject(controlId); var TextBox1 = document.getElementById("TextBox1"); //get HiddenDataMember TextBox1.value = WebGrid1.GetSelectedObject().GetRowObject().GetCells().GetNamedItem("ShipperID").GetElement().attributes["Phone"].value; return true; }
I attached the sample as well.
Hope this helps. Thank you
Thanks Hans,
In this case I didn't want to get the value, but need to recreate the select columns menu due to a bug in the postioning of the context menu. I need a way to get the names of all the columns and whether they are hidden or not when the table is created.
I’m sorry for this misunderstanding.You can still get all columns even if the column is hidden.I made a sample that maybe similar with your scenario.In my sample, I use WebButton to get all columns name and display it to TextBox.Here’s the snippet code in OnClientClick client side event:
function WebButton1_OnClientClick(controlId, parameter) { var WebButton1 = ISGetObject(controlId); var WebGrid1 = ISGetObject("WebGrid1"); var TextBox1 = document.getElementById("TextBox1"); var columnLenght = WebGrid1.RootTable.Columns.length; for (var i = 0; i < columnLenght; i++) { var columnName = WebGrid1.RootTable.Columns[i].Name; var columnVisibility = WebGrid1.RootTable.Columns[i].Visible; TextBox1.value = TextBox1.value + "Column Name: " + columnName + ";"; TextBox1.value = TextBox1.value + " Column Visibility: " + columnVisibility + "; \n"; } return true; }
I attached my sample as well.
Hope this helps. Thank you.
Regrads,Hans.
Thank You, I will take a look shortly. Am in a release process at the moment.
You're welcome John.
Please don't hesitate to ask me again, if you have another question.
I would be happy to help you again.
Regards,
Hans
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