Hi Hector,
Thanks for your patience.
Query: It is required that when an element is added to the master grid, for element it is possible to add elements for the detail grid.It is also required to add a number of elements to the detail grid, say 3 elements, these elements are shown when the detail is expanded.
Based on your query, we understand you need to add the data on detail grids when added data on master grid. We achieved this by using DetailDataBound event with addRecord method and refreshContent method of the grid. Using addRecord method you can add data dynamically to the grid. Please refer to the code snippet below,
|
<ej:Grid ID="gridPublications" DataManagerID="FlatData" runat='server' AllowPaging="true" >
<ClientSideEvents DetailsDataBound="gridPubAuthors" DetailsExpand="detailsExpand" Databound="dataBound" ActionBegin="gridPublicationsBegin"/>
….
</ej:Grid>
</div>
function gridPubAuthors(e) {
. . .
var proxy = e;
setTimeout(() => {
var obj = proxy.detailsElement.find('.e-grid').ejGrid("instance"); //Grid instance
if (ids == filteredData) { //check whether newly added data(ArticleID) and filtered data’s Article ID with same value
obj.addRecord({
PersonID: 66,
OfDate: new Date(),
PersonName: "test",
Country: "uk",
ArticleID: filteredData,
Ignore: false });
obj.refreshContent();
}
},0);
}
</script>
<script type="text/javascript">
//global variable declaration
var ids;
//master grid action begin event
function gridPublicationsBegin(args) {
if (args.requestType == "save") {
// assign the newly added record primary key value in local variable
ids = args.data.ArticleID;
}
}
</asp:Content>
|
Please refer to the below modify sample,
Please refer to the below API documentation,
Kindly get back to us for further assistance.
Regards,
Pon selva