Hi,
I think PG is a bit fussy with its array data.
Not sure what your array looks like but needs to be
1. Numerically keyed
2. Numerical index needs to start at 1
3. No gaps in numerical indexes ( ie 1,2,3,4,5, not 2,4,5)
Ie it should look like this:Data grid is much more permissive that way, it just needs the indexes to be numerical, but in my experience, PG is a lot fussier about this.
Maybe that’s your issue?
I have a vague recollection this also affected me previously and I now rarely use PG because although it’s nice and simple, it’s just too constrained for my needs in many cases…DG isn’t as flashy but it does everything I need it to without headaches…
In your case as you are using filter without re-indexing the resultant array, PG is guaranteed to choke on that…
When I previously used PG with filtered arrays, I had to
1. Store the full array as a custom prop so it wasn’t lost
2. Store the index of the primal element filtered within the filtered element itself so I could reference the full array by the original index
3. Re-serialise the filtered array to start from 1 and be in sequence.
Data grid doesn’t need any of this of course, you can just assign the filtered array without worrying about indexes…
PS
I think PG is a bit fussy with its array data.
Not sure what your array looks like but needs to be
1. Numerically keyed
2. Numerical index needs to start at 1
3. No gaps in numerical indexes ( ie 1,2,3,4,5, not 2,4,5)
Ie it should look like this:
CODE:
PgData[1][data or sub array here ]PgData[2][data or sub array here ]PgData[3][data or sub array here ]…PgData[n][data or sub array here ]
Maybe that’s your issue?
I have a vague recollection this also affected me previously and I now rarely use PG because although it’s nice and simple, it’s just too constrained for my needs in many cases…DG isn’t as flashy but it does everything I need it to without headaches…
In your case as you are using filter without re-indexing the resultant array, PG is guaranteed to choke on that…
When I previously used PG with filtered arrays, I had to
1. Store the full array as a custom prop so it wasn’t lost
2. Store the index of the primal element filtered within the filtered element itself so I could reference the full array by the original index
3. Re-serialise the filtered array to start from 1 and be in sequence.
Data grid doesn’t need any of this of course, you can just assign the filtered array without worrying about indexes…
PS
CODE:
Please use code tags when showing codeThis is the </> button above orBy surrounding code with [ code] [ /code] tags (spaces added to stop these from showing as code)
Statistics: Posted by stam — Sun Nov 03, 2024 4:32 am