-
-
Notifications
You must be signed in to change notification settings - Fork 120
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
Row detail view + row draggable creates weird behavior #256
Comments
oh wow it's incredible to see what users can do with 2 features that were never tested together lol. What I mean is that these 2 features were designed and created independently in the SlickGrid core library, and we never tested dragging and row detail (the later is fairly new, just a few months old) and there's probably still some bugs like yours that may arise when combined with other plugins (row detail & draggable row are 2 separate plugins within the core lib). Anyhow I think that we might need to subscribe internally to the draggable event and close all row details when that happens. There's way too much logic to put in when dealing with row detail and moving rows. For example, we do exactly that when doing a sort, you'll see that when you sort it closes all row details. You might be able to apply a quick fix to collapse all row detail before moving the rows. Try the following in your code onBeforeMoveRows(e, data) {
// collapse all row detail panels before moving any rows
const rowDetailInstance = this.angularGrid.extensionService.getSlickgridAddonInstance(ExtensionName.rowDetailView);
collapseAll();
// the rest of your code
// ...
} Since these 2 plugins are rarely used together, I think that would be the only option and I don't think I should add that in the lib itself because the |
Thanks for the quick response. onBeforeMoveRows(e, data){
const rowDetailInstance = this.angularGrid.extensionService.getSlickgridAddonInstance(ExtensionName.rowDetailView);
rowDetailInstance.collapseAll();
for (let i = 0; i < data.rows.length; i++) {
// no point in moving before or after itself
if (data.rows[i] === data.insertBefore || data.rows[i] === data.insertBefore - 1) {
e.stopPropagation();
return false;
}
}
return true;
} Also, is rowDetailInstance a RowDetailView object? RowDetailView {init: ƒ, destroy: ƒ, pluginName: "RowDetailView", collapseAll: ƒ, collapseDetailView: ƒ, …}
collapseAll: ƒ collapseAll()
collapseDetailView: ƒ collapseDetailView(item, isMultipleCollapsing)
destroy: ƒ destroy()
expandDetailView: ƒ expandDetailView(item)
expandableOverride: ƒ expandableOverride(overrideFn)
getColumnDefinition: ƒ getColumnDefinition()
getExpandedRows: ƒ getExpandedRows()
getFilterItem: ƒ getFilterItem(item)
getOptions: ƒ getOptions()
init: ƒ init(grid)
onAfterRowDetailToggle: Event {subscribe: ƒ, unsubscribe: ƒ, notify: ƒ}
onAsyncEndUpdate: Event {subscribe: ƒ, unsubscribe: ƒ, notify: ƒ}
onAsyncResponse: Event {subscribe: ƒ, unsubscribe: ƒ, notify: ƒ}
onBeforeRowDetailToggle: Event {subscribe: ƒ, unsubscribe: ƒ, notify: ƒ}
onRowBackToViewportRange: Event {subscribe: ƒ, unsubscribe: ƒ, notify: ƒ}
onRowOutOfViewportRange: Event {subscribe: ƒ, unsubscribe: ƒ, notify: ƒ}
pluginName: "RowDetailView"
resizeDetailView: ƒ resizeDetailView(item)
saveDetailView: ƒ saveDetailView(item)
setOptions: ƒ setOptions(options)
__proto__: Object but when setting the type of rowDetailInstance like const rowDetailInstance: RowDetailView = this.angularGrid.extensionService.getSlickgridAddonInstance(ExtensionName.rowDetailView); I get the message that Thanks |
The method Now that you understand what SlickGrid plugins are, there are also Controls, which are very similar to Plugins and are opt in as well. You can see the SlickGrid Controls (basically, ColumnPicker, GridMenu are the main ones). So with all of that, I decided to use the term Extensions in my lib to cover the entire set of Controls/Plugins (here's the list of Extensions in Angular-Slickgrid), each of these Controls/Plugins are actual Extension in my code and are totally separate, which I found much better for debugging purposes (my first implementation was all 1 big Service and that was messy, now they are all separate). Then finally, these Controls/Plugins are called in the core lib by newing them (for example I should probably put that in a Wiki somewhere 🤣 Cheers ⭐️ |
Make sense to me 😄 Another question: I am trying to create a toggle to display/hide a specific column and so far nothing works for me. Any thoughts or solutions? Thanks 👍 |
What do you mean by toggle? Usually the word toggle means hide/show a column and that would be through the Column Picker (right + click on the header titles) or the Grid Menu. To do that later in the game (outside of the page load, meaning without If you instead mean to hide the column completely from the grid (and the pickers all together), |
So However, the columns for dragging rows ( I tried this and it does not work : defineGrid(gridStatePresets?: GridState){
this.columnDefinitions = [
{ id: '_detail_selector', field: '', name: ''},
{ id: '#', field: '', name:'', width: 40, behavior: 'selectAndMove', selectable: false, resizable: true, cssClass: 'cell-reorder dnd'},
{ id: 'status', name: 'Status', field: 'status', formatter: statusFormatter},
{ id: 'airlineCode', name: 'Task', field: 'airlineCode', sortable: true},
{ id: 'process', name: 'Process', field: 'process', sortable: true},
{ id: 'date', name: 'Date', field: 'date', sortable: true}
];
this.gridOptions = {
enableAutoResize: true, // true by default
enableCellNavigation: true,
enableRowMoveManager: true,
rowMoveManager: {
onBeforeMoveRows: (e, args) => this.onBeforeMoveRows(e, args),
onMoveRows: (e, args) => this.onMoveRows(e, args),
cancelEditOnDrag: true
},
enableRowDetailView: true,
rowDetailView: {
process: (item) => this.setSelectedAirline(item),
loadOnce: false,
singleRowExpand: false,
useRowClick: true,
preloadComponent: SpinnerComponent,
viewComponent: RowDetailViewComponent,
panelRows: 9
// expandableOverride: () => {return false}
},
//preset to hide hamburger icon (so that users cannot rearrange rows until they click the edit button)
presets: {
columns: [
{columnId: '_detail_selector'},
{columnId: 'status'},
{columnId: 'airlineCode'},
{columnId: 'process'},
{columnId: 'date'}
]
}
};
// rest of code
}
//toggle view
toggleView(){
//enable edit
if(this.edit)
{
this.grid.setColumns([
{ id: '#', field: '', name: ''},
{ id: 'status', name: 'Status', field: 'status', formatter: statusFormatter},
{ id: 'airlineCode', name: 'Task', field: 'airlineCode', sortable: true},
{ id: 'process', name: 'Process', field: 'process', sortable: true},
{ id: 'date', name: 'Date', field: 'date', sortable: true}
]);
console.log(this.gridOptions);
}
//turn off edit mode (default)
else
{
//show detail selector column to be able to expand rows
//also hide hamburger column so users cannot rearrange rows
this.grid.setColumns([
{ id: '_detail_selector', field: '', name: ''},
{ id: 'status', name: 'Status', field: 'status', formatter: statusFormatter},
{ id: 'airlineCode', name: 'Task', field: 'airlineCode', sortable: true},
{ id: 'process', name: 'Process', field: 'process', sortable: true},
{ id: 'date', name: 'Date', field: 'date', sortable: true}
]);
}
} Any ideas? Thanks ⭐️ |
In my previous post, I mentioned that there seems to be a regression bug with For the rest of the question, it seems that you are fighting against the lib, both the Row Move Manager and the Row Detail plugins uses the first column position (by using column definitions Lastly, Angular-Slickgrid keeps an internal copy of the columns, for example all visible columns and their positions, if you come from the outside and use So all in all, the code you are trying to add is prone to errors. There are certainly plugins that I don't think will work well together, like the row move and the row detail. You might find a way to get it working, and that would be great, but I just don't have the time to help you with this. I do 95% of the job alone in this lib (5% being small contributions and bug filling), I added a bunch of unit tests, now starting to add more Cypress E2E tests and I also contribute a lot to the core lib SlickGrid. So I just don't have the time to help with such non-conventional use case. |
Side note to add to previous post, if you have the time to investigate and make it to work in the Angular-Slickgrid, I would be more than happy to review any PR (Pull Request) to support that. For that, the best would be to fork the lib and add a new example for your use case, then troubleshoot it, get it to work and make a PR. |
Gotcha. |
- now create column definition just by the enableRowMoveManager flag - also keep row selection with dataview syncGridSelection - latest slickgrid version also brought the usabilityOverride callback method that was added in RowMoveManager plugin - possible ref #256
- now create column definition just by the enableRowMoveManager flag - also keep row selection with dataview syncGridSelection - latest slickgrid version also brought the usabilityOverride callback method that was added in RowMoveManager plugin - possible ref #256 Co-authored-by: Ghislain Beaulac <ghislain.beaulac@se.com>
IMGUR LINK TO DEMO: https://imgur.com/a/lUTxqKV
Your Environment
Context
Trying to create a grid with draggable rows for rearranging + rows with detailed view.
Expected Behavior
When rows are expanded to detailed view and dragged to be rearranged, detailed view should still be the same and contents of neighboring rows should not be affected.
Current Behavior
When rows are expanded and dragged, the detailed view disappeared. Also, contents of the rows between the original row position and the new row position disappeared / are missing.
(can be shown in imgur: https://imgur.com/a/lUTxqKV)
Possible Solution
Code Sample
The text was updated successfully, but these errors were encountered: