SitePen / dgrid

A lightweight, mobile-ready, data-driven, modular grid widget designed for use with dstore
http://dgrid.io/
Other
628 stars 298 forks source link

Addrowdelrow #1441

Closed pemn closed 4 years ago

pemn commented 5 years ago

Adds a new simple mixin component with two related funcionalities: A ➕ button on the header, on a "virtual" column to create a new, empty, row at the end of the table. A ❌ button on each body row, on the same "virtual" column, to remove that row. Mockup example of the result:

col1 col2
value1a value2a
value1b value2b
value1c value2c

I could not find any existing component that provides this kind of very useful funcionality so it may be a nice new addition to master.
My approach to the renderRow override may be a bit hacky, but if nothing else its a good proof of concept to be reimplemented by someone with better undertanding of the dgrid practices.

edhager commented 5 years ago

Can you please add unit tests and in test, add an HTML file that shows the new mixin in action.

pemn commented 4 years ago

Created a test file: test/extensions/addRowDelRow_dstore.html The mixin always will require a data manager like dstore to work. Due to corporate limits on software, i can only work on a very unconventional development enviroment. Would be nice if someone polished the edges using more conventional dgrid standard and practices.

msssk commented 4 years ago

Thank you for your effort to improve dgrid!

dgrid aims to be an extensible grid that provides a reliable foundation of common functionality that makes it easy to create just about any kind of grid. dgrid does not aim to provide all features out of the box, especially if there's a lot of variety in the ways those features might be implemented in different applications.

There is a maintenance and complexity cost to all code that is added to a projec. I don't think this is a compelling addition to dgrid's core functionality. Anyone requiring this functionality can add it without much effort. It is likely to be implemented differently depending on the application. To meet the varied needs of dgrid users it would have to provide customizing which column contains the delete button, disabling/enabling the add button and the delete column individually, customizing the rendering of the add/delete buttons, and customizing the action of adding a new item to the store.