- Home
- Forum
- ASP.NET MVC - EJ 2
- Numbering always from 1 after filter in Grid
Numbering always from 1 after filter in Grid
Hi, I have a qestion. Is there any way to numbering records in Grid always from 1 after filter by another column?
Lp Data2
1 355
2 360
3 362
4 342
After filtering by Data2 column I have:
Lp Data2
4 342
1 355
2 360
3 362
I would like to get result like this:
Lp Data2
1 342
2 355
3 360
4 362
Regards :)
SIGN IN To post a reply.
4 Replies
HJ
Hariharan J V
Syncfusion Team
April 25, 2019 09:50 AM UTC
Hi Bart,
Thanks for contacting Syncfusion support.
We suggest you to use Sorting feature for sorting particular columns to ascending/descending order. Please refer the below online sample and demo link.
If you to apply soring on grid initial load, please use the following documentation.
Regards,
Hariharan
BA
Bart
June 10, 2019 09:39 AM UTC
Hi, Hariharan J V
thanks for your reply but this is not what I mean. I need catch a sorting event on one column (in my example: Data2) and change numbering in another column (Lp) always from 1..N.
Regards :)
BA
Bart
June 11, 2019 09:18 AM UTC
Any ideas?
HJ
Hariharan J V
Syncfusion Team
June 12, 2019 09:27 AM UTC
Hi Bart,
We suggest you to use the below logic to achieve this requirement,
|
<script type="text/javascript">
var count = 1;
var flag = false;
var resLen = 0;
function actionBegin() {
flag = true;
}
function rowDataBound(args) {
if (flag || resLen==0) {
count = this.pageSettings.currentPage * this.pageSettings.pageSize - this.pageSettings.pageSize + 1;
resLen = this.currentViewData.length;
flag = false;
}
args.row.cells[0].innerHTML = count; // Changed the particular column cell value
resLen--;
count++;
}
</script> |
We have used Grid actionComplete event and rowDataBound event to achieve this requirement. For your convenience, we have created the sample with this requirement and you can find that sample from the below link,
Regards,
Hariharan
SIGN IN To post a reply.
- 4 Replies
- 2 Participants
-
BA Bart
- Apr 24, 2019 09:36 AM UTC
- Jun 12, 2019 09:27 AM UTC