anmcgrath / BlazorDatasheet

Simple excel-like datasheet Blazor component
MIT License
163 stars 40 forks source link

Question: alternate approaches to binding data? #45

Closed jasonswearingen closed 1 year ago

jasonswearingen commented 1 year ago

Hi I am wondering if it's possible to separate the datasheet "presentation" from the underyling data a bit more than shown in the example.

For example, in the index.razor it generates a List<Person> which is then fed into the ObjectEditorBuilder. Instead of passing a list of rows, Is there a way to instead pass a List of columns, that are bound to some backing Data (one Data List per column)? With the underlying Data being updated when the datasheet changes (or vice-versa)?

If this is not currently possible, how would you suggest I attempt to go about adding such a feature?

Thank you for reading this :)

jasonswearingen commented 1 year ago

Turns out I am wrong about wanting to specify data in columns, it should be in rows (to match whatever the db structure is)

If you have some suggestions on how to do this kind of "data binding", or if some refactoring needs to occur to do that, you can let me know a starting point and maybe I can figure out a solution

jasonswearingen commented 1 year ago

I took a look at the sync fusion datasheet and was able to get my scenario working via the System.Dynamic.DynamicObject type.

I am thinking if this could be used for per-row storage inside BlazorDatasheet, it's type could be customized per developer to bind whatever external data they need.

If you have any thoughts/suggestions on this I'd love to hear, otherwise I'll probably get back to this in a few weeks. (I need to validate the other functional areas of my PoC before settling down on implementing anything)

jasonswearingen commented 1 year ago

looks like I want to create a custom Sheet object so that's what I will try! will open a new issue if needed.

anmcgrath commented 1 year ago

The ObjectEditor wrapper around the sheet was intended for working with data collections but I haven't got around to implementing the full functionality of it. I'd be interested to see what you come up with.

jasonswearingen commented 1 year ago

Thank you for the reply, I'm still in the stage of just doing PoC for the various tech/workflows my idea needs, so honestly I probably won't get to this for a bit. I did my PoC for sheets using sync-fusion, which is pretty meh but has the basics. I think I should finish my PoC with that and then figure out how to add all those required features to your project. For example, I have no idea how pagation systems work and how that might impact a customSheet object so I better get familar with their use first. (I am new to webdev)