-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Primary key for rowEditable and index number of the row #5509
Comments
|
This is my example with custom table |
Having the chance to template the row selection column, you can put whatever you want - which means in that case you can put index and checkbox at the same time and also you can put index that is not bound to the data source. By default, if you want to show row selector, it will be still only a checkbox, which means that if you want to overwrite it (like the demo above), you will need to put manually the checkbox again, in addition to the other things you want to show in the row selection column (in your case - the index). |
I do not want to insert an index into the same column where the checkbox is located. I dont want to generate a unique index every time when I receive new data (filtering, sorting), but it looks like there is no choice now. In working with tables, it may often be necessary to have a ordinal row number, which you can add by parameter in configuration igxGrid (how with rowSelectable) in a cycle of drawing virtual tables. Igx itself calculates and inserts the lines and it can also add a sequence number. He can also add a row index by parameter in order not to change data from the server to the client and not to do an empty job of inserting the: index = workArray[i] + 1. workArray = [{name: 'Ben'}, {name: 'John'}]; But the igx itself can do it by parameter, because it is a sequence number. It uses everywhere. Example below |
Rows in the grid have an index property that can be used in templates: <igx-column [header]="'Index'">
<ng-template igxCell let-cell="cell">
{{cell.row.index + 1}}
</ng-template>
</igx-column> It'll however include group rows. If you use grouping but don't want group rows included you can use the solution in this issue: #5398 |
It's cool, it's work, without filter param([allowFiltering]="true"). If i add this param i get empty table with error, but without index column, i get not empty table with error. It seems like its the same problem as in #5495. But if we are using filterMode='excelStyleFilter' everything is working, but i cant use this filterMode because of this task #5448 is not done. One question. Can i use this 'Index' as Primary key for row edit (rowEditable)? |
The primary key is something that is coming from the database and you cannot put a templated column as a primary key. What you can do is set grid's primary key (taking it from the database), but don't define a column for it and it will not show in the grid. At the same time, you can use the cell template @ChronosSF shown above and define your index column. |
Yes, that's a good idea, thanks. May add description to documentation by primary key (that may be using key not showing in the grid). |
Because i want show index in row for user and i dont want insert him in my work data every time in my component, and users should see at the index row
The text was updated successfully, but these errors were encountered: