-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add editCell to gridPro #3354
Add editCell to gridPro #3354
Conversation
packages/grid-pro/src/vaadin-grid-pro-inline-editing-mixin.d.ts
Outdated
Show resolved
Hide resolved
throw new Error('Invalid colIdx (out of bounds)'); | ||
} | ||
|
||
const column = columns[colIdx]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Column reordering isn't taken into account
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, you can pass a columnId and that ensures reordering is not a problem. What do you suggest for situations where the index is directly passed ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC the API design accepts "path" only
|
||
// Make sure row[rowIdx] exists | ||
if (rowIdx > tRows.length || rowIdx < 0) { | ||
throw new Error('Invalid rowIdx (out of bounds)'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't sound right to throw an error depending on the scroll position of the user & how many items the virtual scrolling engine has decided to render in DOM?
@@ -455,6 +455,63 @@ export const InlineEditingMixin = (superClass) => | |||
super._updateItem(row, item); | |||
} | |||
|
|||
/** | |||
* @param {Number | String} row |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Examining the code, seems that row
could also be an item?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not anymore, but I'd like this possibility, especially because of scrolling. Passing the index only works well if all items are being shown.
<vaadin-grid-pro-edit-column path="name" id="name"></vaadin-grid-pro-edit-column> | ||
<vaadin-grid-pro-column path="age"></vaadin-grid-pro-column> | ||
<vaadin-grid-column> | ||
<template>[[item.name]]</template> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use the deprecated template API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just copied from other examples. How should I do it ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case the column isn't essential for the test, it can be removed. If it is, see the documentation for how custom content is provided for grid column cells (renderer
API)
throw new Error('Invalid rowIdx (out of bounds)'); | ||
} | ||
|
||
this._startEdit(tRows[rowIdx].cells[colIdx], column); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rowIdx probably refers to a virtual index and not the index of the element in the DOM (which wouldn't be correct for the API due to virtual scrolling). If rowIdx was, let's say 1000, this would fail since there are not that many physical rows in the DOM.
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Closing as stale. Not all of the comments were addressed by the contributor and the approach is not consistent with the existing APIs. Feel free to reopen if still relevant. |
Hi, so no triggering editor mode via code? Is there any workaround? |
Description
Adds trigger from the backend side to open the cell editor.
Fixes # (issue)
Type of change
[ ] Bugfix
Checklist
Additional for
Feature
type of changeAPI for entering edit mode on Grid Pro platform#2674