Hello mcseidel ,
I apologize about the delayed answer.
Adding additional elements after the container grid is not supported out of the box. Making changes to the child grid however will trigger updating events like it does for the parent grid.
So in that event you can update the data source of the grid. As for triggering a call to the server. If you have activation behavior enabled the updating will trigger on every cell value changing after you change the active cell. Otherwise if you’ve enabled batch updating any page postback will trigger the updating event.
For editing of only some of the cells you’ll need to enable editing behavior for the child band (container grid you created) and set the EditingColumnSettings correspondingly with ReadOnly to true for the columns that should not be editable and ReadOnly to false for the ones that should be editable.
Please refer to the attached sample and let me know if you have any further questions.
Best Regards,
Maya Kirova
Developer Support Engineer
Infragistics, Inc.
http://es.infragistics.com/support
Thanks, that was helpful. I'm moving in the same direction of setting individual behaviors on the instance of the child grid and might ask couple of questions withing this post framework later.
While looking into the sample website that you've sent :
1. Isn't this code suppose to turn on editing of every cell in the childgrid except "id" column..
ColumnEditSetting settings=new ColumnEditSetting(); settings.ColumnKey="id"; settings.ReadOnly=true; if (childGrid.Behaviors.EditingCore == null) { childGrid.Behaviors.CreateBehavior<EditingCore>(); } if (childGrid.Behaviors.EditingCore.Behaviors.CellEditing == null) { childGrid.Behaviors.EditingCore.Behaviors.CreateBehavior<CellEditing>(); } childGrid.Behaviors.EditingCore.Behaviors.CellEditing.ColumnSettings.Add(settings);
Somehow it is not happening when I've run web side. All cells are read only.....
2. Also what property would turn particular cell into read only ( disable) so that different cells within a column could be editable or not . ( Means cells of the same column in different rows)
3. Whould it be that RowIslandDataBinding a good place to change edit-ability of particular cell...
Thanks
Sorry, actually editing ( #1) works fine, I missed that default trigger is double click... can you just answer 2
& 3 please. Thanks.
Here #4 :
I have pretty much close scenario to your site, EditCore & cell editing turned on on the parent grid and in the whdg_RowIslandsPopulating I'm trying to set behavior (cell editing) for the child grid :
ContainerGrid IslandGrid = new ContainerGrid(); IslandGrid.AutoGenerateColumns = false; e.Row.RowIslands.Add(IslandGrid); IslandGrid.Behaviors.CreateBehavior<EditingCore>(); IslandGrid.Behaviors.EditingCore.Behaviors.CreateBehavior<CellEditing>();
At this point I would think that child grid should become editable, but it does not. Parent grid actually editable but the child is not. I compared with you setting and do not see any difference, although seems like some small piece is missing. What could cause child grid not to behave as editable after editcore & editcell are added?
It seems the same as in my sample code. I don’t see anything that might be causing in your code snippet. I can however suggest that you enable the inheritance for the parent band so that the nbehavior will be transferred to the child band as well:
<Behaviors>
<ig:EditingCore EnableInheritance="true">
<ig:CellEditing EnableInheritance="true">
</ig:CellEditing>
</Behaviors>
</ig:EditingCore>
Also make sure that you don’t create anew the behavior if it’s already created For example set:
if (childGrid.Behaviors.EditingCore == null)
{
childGrid.Behaviors.CreateBehavior<EditingCore>();
}
if (childGrid.Behaviors.EditingCore.Behaviors.CellEditing == null)
childGrid.Behaviors.EditingCore.Behaviors.CreateBehavior<CellEditing>();
Regarding setting a cell to be read-only . There is currently no direct setting for this. You can only set a specific column to be read-only in the code-behind. You could however handle the entering edit mode client side event (if the column, in which the cell is, is editable) and if the specific cell shouldn’t be editable you can cancel the event. This will make it read-only.
I’m attaching a modified sample with the above mentioned changes. Note that the child column “Item” is not set to be read-only in the code behind but in the editing event for all cells from that column the event gets canceled.
I was able to resolve my issues by setting ajaxEnabled to false.
Thank you
I am adding this in the rowIslandsPouplating mehod but I get a script error when the child grid expand. Runtime Exception: TypeError: $IG[objName] is not a function
My code:
var child = new ContainerGrid();
e.Row.RowIslands.Add(child);
var selection = new RowSelectors
Enabled = true,
RowNumbering = false,
RowSelectorCssClass = "selector",
HeaderRowSelectorCssClass = "HeaderRowSelector"
};
child.Behaviors.Add(selection);
selection.RowSelectorClientEvents.RowSelectorClicked = "whdg1_RowSelector_RowSelectorClicked";
child.DataSource = dt;
child.DataBind();
Updating Main Grid.Maya, I looked at you sample and it does updates the main grid value as expected. But my scenario is different. I have problem updating main grid right after changes done to child grid in RowUpdating event. If event triggered by main grid then it is not a problem e.g. after line mr.Amount = 95000; executed I can see changes on the main grid, if I try to do the same in the child grid section of the same event it’s not working even if I DataBind main grid again. This is the place where mr.Amount = 35000; got executed. The issue that I do not know how to address is the following : MainGris get binded on the PageLoad that executed before RowUpdating event, so when value in the master source changed ( mr.Amount = 35000) it could be seen only on the next postback (after any other child grid get expanded). So somehow if the change occured in main grid and new value assign to underline source (mr.Amount = 95000) then changes can be seen, if event triggered by child grid then changes to main grid ( mr.Amount = 35000) can be seen only after another postback. Can you advise how to make mr.Amount = 35000 visible without postback.Project attachedThanks.
Make sure that you make the changes for the parent grid directly to the WebHierachicalDataGrid instance. Otherwise the approach is the same.
I tested it by setting a value of 1 to the first row’s Amount column and it got recalculated and persisted as expected.
You can get the summary result from the SummaryCalculated event from the event args:
protected void whdg_SummaryCalculated(object sender, SummaryEventArgs e)
var value = e.SummaryValue;
You can’t directly access it fromthe behavior.
Please refer to the attached sample and let me know if you have any questions.
The RequestFullAsyncRender did the job to persist updating the child grid I’m also trying to update parent grid with the child’s total amount value and need some help to sequence events :In the whdg_RowUpdating if I would add to your sample the following : islandType3Tbl.Rows[0][4] = 1300; then amount column get updated and persisted, and custom sum get recalculated, so it works perfect... now I’m trying to get this recalculated summary value and put it into the parent row, something like : ExhibitLR2MasterDS mDS = (ExhibitLR2MasterDS)Session["data"]; mDS.MasterTable.Rows[1][4] = 1201;where 1201 is the summary for the amount field in the child grid. Can you help me with the following :1. On the server side how to access summary value , seems like something as grid.Behaviors.SummaryRow...?? but what exactly ?2. What to do with parent grid right within whdg_RowUpdating so the parent row also would show new value and parent grid total get recalculated. I tried to do the same as for child grid ( clear datasource, get new one, etc. ) and it did not work. Can you advise and/or maybe update the your version of the site : whdg_LoadOnDemandEdit01_Modified.zip