Open WalkOffEarth opened 7 years ago
facing the same problem even not in editing mode
I am facing the same issue. @WalkOffEarth , @osamasaeed Do you have a solution for this issue?
Encountered the same issue.
Previously, I've used 9.3.1 version and now just updated to the most recent one - 10.2.3 - and I'm facing this issue.
Before 10.2.3, each row object passed to any of the event handler callbacks had $$index
property as mentioned here - https://swimlane.gitbooks.io/ngx-datatable/api/table/internals.html
But now, it's gone... Anybody found any alternatives to this? This is a crucial, software-breaking bug.
@WalkOffEarth have you tried let-rowIndex="rowIndex"
in the following example:
<!-- Row Detail Template -->
<ngx-datatable-row-detail [rowHeight]="100" #myDetailRow (toggle)="onDetailToggle($event)">
<ng-template let-rowIndex="rowIndex" let-row="row" let-expanded="expanded" ngx-datatable-row-detail-template>
<div style="padding-left:35px;">
<div><strong>Address</strong></div>
<div>{{row.address.city}}, {{row.address.state}}</div>
</div>
<div>row index: {{rowIndex}}</div>
</ng-template>
</ngx-datatable-row-detail>
@Inlesco rowIndex works on version 9.3.1? I just updated to version 9.3.1 but it doesn't work for me.
@BearandYoon no, rowIndex
does not work on 9.3.1, thus, why I decided to update.
I was referring to $$index
property being part of rowItem object that's, f.e., onSelect
callback's payload.
FYI, $$index
was removed in 10.0.0, but rowIndex
wasn't added to rowDetails
till version 10.0.2.
@wizarrc Thanks for your reply. So which version should I use for a rowIndex?
@BearandYoon version 10.0.2+ should work. check the changelog for details on features/bugfixes you are looking for.
Hi @wizarrc rowIndex is working for me. Thanks. 👍
I have another issue on ngx-datatable(inline-editing).
As you can see, I have several sub-rows(https://go.gurn.io/test, https://go.gurn.io/test) in a table row. When I change first sub-row, second sub row also is changed. For ex: I changed https://go.gurn.io/test to https://go.gurn.io/test1, and choose the another element. then second sub-row also is changed to https://go.gurn.io/test1.
I guess it is ngx-datatable issue. Do you have a solution for this issue? Thanks.
@wizarrc Hey!
Regarding FYI, $$index was removed in 10.0.0, but rowIndex wasn't added to rowDetails till version 10.0.2.
, I'd like to ask - how to get the index of a row now in the onSelect or any other callback's you provide for ngx-datatable
component?
Example:
(activate)="allowRowSelection ? onActivate($event) : false"
(select)='onSelect($event)'
Basically, I want onSelect
args to contain a rowIndex
of some sort and since you've removed $$index
from the row object supplied in the callback by default, I don't see any other clean way, except for managing indexes on your own.
Also, could you please update this - https://swimlane.gitbooks.io/ngx-datatable/api/table/internals.html - since $$index
is removed (unless I misunderstood something)?
I'd like to ask - how to get the index of a row now in the onSelect or any other callback's you provide for ngx-datatable component?
@Inlesco As far as I know, the maintainers of the project are the employees of the Swimlane company. I don't provide anything at the moment and I did not remove $$index
from the project, though I was in favor of it. I am working on a forked copy of the project for a personal project of mine, but right now I contribute some code fixes and have been answering some questions on here. I've been arguing the same thing that you suggest with other callbacks.
Refer here on a conversation I had about how to change the selected property and the corresponding event to be more useful.
This is an open source project, so feel free to open up issues on here with bugs you find or feature requests you want. Also, if you got value out of the project, consider forking the project and contributing changes for consideration by the project maintainers. That's what I did earlier this year.
@BearandYoon I have no idea. Do you have a plunker demo?
@wizarrc
sorry, confused you with the primary repo contributors. it's pretty sad that there's no deprecation warnings or anything when such modifications are being made. it'd be great if they added console.warns on a new version (toggleable, of course), especially if there's breaking changes in the API.
otherwise, the user of the package has to waste tons of time searching for solutions, comparing his local package version to the one in the official examples, even to pull the official ver. to this system, run it on localhost and observe things.
i'd gladly contribute on this if I had enough time. i may have some time in a couple of weeks later, we'll see.
@Inlesco The reason there is no deprecation warning is:
$$index
for the sake of compatibility would be a much larger task, possibly contain bugs, and make the table slower (though very minor) due to double accounting.$$index
was to make it immutable, so the point was the actual feature people requested. So suggesting adding it back would break people who are using version 10+ depending on their collection not being modified by the library.I agree that the correct move for such limiting factors was to make a clean break. The good news in all that, it that your project wont auto upgrade you to a major version number, and when you do upgrade, you are expected to see what the breaking changes are and adjust your project accordingly, which should be very minor since a table is probably a small component in a larger project, unlike say Angular, where they must be very careful, because projects are built entirely using their library/framework.
I had to work around this issue by creating a hidden column and copying the rowIndex into that column. It's hacky and I'd appreciate having rowIndex in rowDetails back.
while implementing edit functionality to row details not getting rowIndex.