Hi
Can you please let me know how can we update the other row element when we update one of the element is the same row.
I have used (rowEditDone(event: any, ui: any)) event but not able to do the changes in other row element.
For example :
if i have a row with data like
Number of parts : 10
No of defective parts :
No of corrected part :
if user update the corrected part to 8 then i need to calculate the defective part (Total parts - corrected part ) then i need to set the data as defective part as 2.
Hello,
This can be achieved by utilizing the editCellEnded event to then modify the corresponding cells utilizing the setCellValue method to set the values of the other columns.
Let me know if you have any questions.
I am not able to update the cell value by using setCellValue method and also i need to update its parent.
Can you please let me know how can i do that ?
As in the editCellEnded event i am not able to get parent data.
One more question i need to set HTML div tag or Angular2 Component to render before displaying as shown in pic.At the time when we edit the cell. Please have a look at it.
It looks like the setCellValue method is being invoked prior to the grid being initialized. Is this method being called within one of the components lifecycle hooks?
Please provide more details as to at what point of the component's lifecycle the method is being called.
Please have look at the code. for updating other cell values (for example "Name" and "Html" in code attached) depending upon the edited value in price.
For Example:
if price is more than 10 then "Html" field is set danger with css "line-color-danger".
In this example i am facing two issue :
1. Not able to set values.
2. Not able to see HTML div element.
Can you please help.
Note : this issue very urgent. If we can have call it will be good for me. My number is +919922957202
I am attaching a sample that fulfils these requirements by modifying the provided sample.
The first modification I made was to handle the editCellEnded event rather than the editCellEnding event as this indicates that the cell value has already updated. These events are mostly interchangeable though, use whichever works best in your scenario.
It is important to note that the igHierarchicalGrid is built by multiple igGrids and to obtain an instance of child grids cannot be done by using the jQuery selector using the id of the table element used to setup the grid. The igHierarchicalGrid exposes a allChildren method for these purposes. Subce we are trying to update the values of the child band during the editCellEnded event, the API can be used to obtain an instance of the igGridUpdating feature of the igGrid that we are looking to update by using ui.owner. ui.owner can then be used to invoke the setCellValue method which then changes the logic within the editCellEnded event handler to this:
ui.owner.setCellValue(ui.rowID, "Name", "Test"); if(ui.value > 10){ ui.owner.setCellValue(ui.rowID, "Html", "<div class="line-color-danger">Test</div>"); } else{ ui.owner.setCellValue(ui.rowID, "Html", "<div class="line-color-notdone">Test</div>"); }
I am able to update child but facing issue regarding to update its parent too.
1. How can we get the parent row data and edit the values over there also in a editRowEnding event?
2. How can we get the whole data model that is used for populating the table in an event as i am using typescript "this" will not work? Is there any better option?
3. i want to commit the whole data model in to my data base at once while using autocommit : false. How can we achieve this?
Updating the parent row of a child grid is not built into the API but can be worked around by using some DOM traversal. I suggest looking into the this forum thread with more details on how to achieve this: http://es.infragistics.com/community/forums/t/85421.aspx
There is a allRows method that can be utilized to obtain the data from all the rows. The issue presented with the igHierarchicalGrid though is that it only returns data from all visible rows, therefore, if a row is collapsed this method will not return the data from those rows. It is possible to expand all rows though by utilizing the expand method of the igHierarchicalGrid as discussed in this forum post: http://es.infragistics.com/community/forums/t/88627.aspx
I suggest utilizing the pending transactions method to obtain only the rows that have been modified which will make this more performant in most scenarios.
To summarize, here they utilize the editCellEnded event but this can be modified to instead utilize the editRowEnded event. The API for both of these events expose a ui.owner which is a reference the the IgGridUpdating feature from which the DOM element hosting the grid can be obtained by invoking ui.owner.grid. From here DOM traversal is used to obtain an the row ID of the parent which can then be used to invoke the method to obtain the data of the row.
To obtain parent row data before editing, the code would be very similar as this will already provide the record data of the parent row. Here you would instead handle the editRowStarted event.
How can I get parent row data while editing it's child and also need to update parent depending upon the data of child edited?
The grid does not provide an API for an editable or readable view model that reflects the state of the grid.
The pendingTransactions method does provide a way to obtain all current modifications to the grid in a single object.