- Home
- Forum
- ASP.NET Core - EJ 2
- Correct way to implement DataGrid in PartialView
Correct way to implement DataGrid in PartialView
Hi there,
I am currently using EJ2 Grid as partial view components, so far it's working great. I am able to get and set the data successfully.
But I am now facing an issues where I can't get the correct selected record on 2nd load, where the grid will return me the value from 1st data set.
Details step below, with sample data.
- The grid is load with first set of data on load.
- Click on 1st row, return 1.
- Click on 4th row, return 4.
- Load the second set of data by clicking load button with filter text from input.
- Click on 1st row, return 1.
- Click on 4th row, return 8.
First set of data: { 1, 2, 3 , 4, 5, 6, 7, 8, 9, 10 }
Second set of data: { 2, 4, 6, 8, 10 }
Attach is the code I used, is there anyway I am doing wrong on this or some additional setup are required for the partial view script to run on second load.
Attachment: Sample_f8f5faa7.zip
SIGN IN To post a reply.
3 Replies
PS
Pavithra Subramaniyam
Syncfusion Team
April 2, 2019 12:30 PM UTC
Hi Skye,
Greetings from the Syncfusion support,
We have analyzed the provided a code example and found that you have bounded the server returned result in innerHTML of Grid in Ajax.Success function from the loadData method. In this case, you have bound the result value to EJ2 Grid DOM Element instead of Grid dataSource. you can update the Grid’s dataSource using that result value. So that the Grid data will be refreshed and will provide the correct record on Grid row selection. Could you please provide more information about your query that will be helpful for us to provide a better solution as soon as possible.
- Share the video to demonstrate the issue.
- Share the result returned from the ajax call.
- If possible share code example or sample for further analysis.
Regards,
Pavithra S.
SK
Skye
April 3, 2019 12:25 AM UTC
Hello,
I actually manage to fixed this issue by using (args).
function rowSelected(args) {
const index = args.rowIndex();
const index = args.rowIndex();
var selectedrecord = args.data;
}
Regards,
Skye
PS
Pavithra Subramaniyam
Syncfusion Team
April 3, 2019 04:36 AM UTC
Hi Skye,
Thanks for your update.
We are happy to hear that you have resolved the issue.
Please contact us if you need any further assistance. As always, we will be happy to assist you.
Regards,
Pavithra S.
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
SK Skye
- Apr 1, 2019 08:13 AM UTC
- Apr 3, 2019 04:36 AM UTC