This behavior is beyond RadGrid's capabilities but it is possible to be implemented. I happen to have a VB sample (see attachments) without hierarchy, but the same approach can be used with hierarchy. See the following short video: RadGrid Highlight last inserted item
You can use the following example a starting point and adjust the project further to make it meet the requirements.
Depending on the Data Binding technique, (Advanced Data Binding, Declarative DataSource) you may need to choose the right event where you will have access to the ID of the last inserted row.
Here are some instructions:
Once the DataSource is updated, rebind the grid
Set the current page Index to the last page
Add a custom attribute containing the last inserted item's ID as value
Wire up the GridCreated client-side event to the Grid
In the GridCreatedEvent handler, verify that the custom attribute exists
Loop through the GridItems of the current page and check the one that has the same ID as the one stored in the custom attribute
If the Item is found, add a custom CSS class name to the row element.
Use CSS Style to highlight the row that has the custom CSS class
Code Snippets
VB - InsertCommand
ProtectedSub RadGrid1_InsertCommand(sender AsObject, e As GridCommandEventArgs)
'' code to insert data into the datasource
RadGrid1.Rebind() '' rebind the Grid
RadGrid1.CurrentPageIndex = RadGrid1.PageCount '' change the page to last page
RadGrid1.Attributes.Add("data-lastInsertedId", newRow("OrderID")) '' add custom attributeEndSub
JavaScript - GridCreated event handler:
<script type="text/javascript">
functionOnGridCreated(sender, args) {
var lastInsertedId = $telerik.$(sender.get_element()).data().lastinsertedid;
if (!lastInsertedId) return;
var grid = sender;
var masterTable = grid.get_masterTableView();
var dataItems = masterTable.get_dataItems();
for (var i = 0; i < dataItems.length; i++) {
var dataItem = dataItems[i];
if (dataItem.getDataKeyValue("OrderID") == lastInsertedId) {
$(dataItem.get_element()).addClass('highlight');
break;
}
}
}
</script>
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers.Learn More.