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
I am using Batch Update with Client Binding.
I am looking to add the functionality for a user to right click on a cell and select "fill down" to fill that value in all of the cells for that column.
I am using Virtual Paging and Grouping. I would prefer the ability to fill based on the selected group and the current rows displayed (based on the Virtual Paging).
Does anyone have a sample of the javascript to handle this "fill down" feature?
Dave
For example, if the return value of GetGroupRowLevel() from cell within the country of Japan, the city of Tokyo, and contact title of President is 1_2_3, please try to use following snippet code.
var groupCountry = grid.GetRootTable().GetGroupRows()[0].Cells[0].Text; alert("Country: " + groupCountry); var groupCity = WebGrid1.RootTable.GetGroupRows()[1].GetChildren()[2].Cells[0].text; alert("City: " + groupCity); var groupContactTitle = WebGrid1.RootTable.GetGroupRows()[1].GetChildren()[2].GetChildren()[3].Cells[0].text; alert("Title: " + groupContactTitle);
We need to use GetChildren method for the city group and contact title group since this group level is the child group level of its parent group. City group is child group of country group and contact title group is the child group of city group.
Please let us know whether it helps or not.
I enclosed one simple sample of batch-update with client-binding WebGrid with virtual paging and grouping enabled. The grid is bind to Customers table of Northwind.mdb. In the sample, OnRowContextMenu client-side event is used to add a new customized menu item, Fill Down, into WebGrid’s row context menu.
The Fill Down menu item will set/fill the value in all of the cells for Region’s column.
Please kindly check the attached sample and let us know your response.
Yudi,
That sample is close, but there is one large difference. I do not know what the user will group by - so I can't use a Case Statement. How do I get those values dynamically?
Here is the psuedo code that I was thinking of:
ColumnName = GetCurrentCell.ColumnName
ValueToFill = GetCurrentCell.Text
GroupToUpdate = GetCurrentCell.MyGroup //Could be grouped by multiple columns (City, Country,..)
//Update Client
For ALL Rows in GroupToUpdate
Row.GetCell(ColumnName).Value = ValueToFill
//Update Server Side - need to update the values NOT currently displayed based on Virtual Paging
UpdateDatabaseOnServer(Group Info, Column Name, ValueToFill)
I need to be able to get to the Group Info for this specific cell.
In order to get grouped row dynamically, please try to follow this step-by-step.
First, we will need to get the index of the grouped row. We can use following code in order to get the index of the grouped row.
WebGrid1.GetSelectedObject().ToRowObject().GetGroupRowLevel();
Suppose we have a grid grouped by Country field and the sort mode is ascending, as shown in the sample file I attached on my previous post. The index of “Argentina” group should be 0, “Austria” group should be 1, “Belgium” group should be 2, and so on.
If the grid is grouped by more than one field, for example: grouped by Country > City, then the return value of the snippet code above will be as follow: [group index of country field]_[group index of city field]. E.g.: 0_2 or 1_8, etc.
Next, we will use the group index to get the text of the grouped. For example, customer with company name Rancho Grande comes from Argentina. In order to get the “Argentina” text (still refer to the same sample where the grid is grouped by country), please try to use following code.
WebGrid1.GetRootTable().GetGroupRows()[grpIndex].Cells[0].Text
Hope this helps.
Hi Yudi,
How do I get the name of the columns being grouped by? For example - "Country" and "City"? I need to pass those to my WebService to actually run the query to update the Cell.
Also, how do I get the name of the current column that I am on?
I need the GroupByExpression on the Client side - how do I get that?
Please use following snippet code in order to get the name of the columns being grouped by.
WebGrid1.RootTable.GetGroupByExpression()
And use following snippet code to get the current column that user currently is on.
WebGrid1.ActiveEditCell.ToCellObject().Name
I have one remaining issue. I need to send the value for each grouping item for the cell I am currently on. For example, if we are grouped by Country, City, ContactTitle and I am selecting a cell within the Country of Japan, the City of Tokyo and ContactTitle of President. How do I get those values?
I am able to get the
I am able to get the value of the first Group - which is Country = Japan, but I can not get the last two groups.
I can get the Group Index and Group Array as well:
var groupIndex = grid.GetSelectedObject().ToRowObject().GetGroupRowLevel(); alert("groupIndex: " + groupIndex); var groupArray = groupIndex.split("_");
Here is how I get the Country Name:
var groupName = grid.GetRootTable().GetGroupRows()[0].Cells[0].Text alert("groupName: " + groupName);
I thought I could get the city name by using that same line, but I receive a Javascript error:
var groupName = grid.GetRootTable().GetGroupRows()[1].Cells[0].Text alert("groupName: " + groupName);
So How do I get the City Name and the ContactTitle for the select Cell/Row?
Thanks,
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