anmcgrath / BlazorDatasheet

Simple excel-like datasheet Blazor component
MIT License
131 stars 31 forks source link

[Question] How to Add a column while running, bound to items? Also question about replacing Sheet #47

Closed jasonswearingen closed 1 month ago

jasonswearingen commented 1 year ago

Hi, I'm finally at the point where I can play with this cool sheet library again.

I see in the main demo I can add new columns at runtime, but they are not bound to the existing Items

What is the suggested approach? Like if I had some additional property that I want to add later.

It looks like one way I could do this by making Sheet.SetCell() public then looping through and setting the Cell values manually.

On a related note, it looks like Sheet is designed to support being replaced, is that true? I am imagining rewriting it, simplified down to only support my requirements. (data stored in rows, and all types/formatting defined per column). If you think it's doable I'd love to hear, or what issues you think I might come across.

anmcgrath commented 1 year ago

Hi Jason, sorry it's taken me so long to get back to you.

My intention was for the object editor to handle this - and yes I think the solution is at this stage to loop through and use sheet.SetCell - you can see that I've done that for inserting items using the object editor.

I haven't really considered being able to replace the sheet apart from sharing the instance across multiple editors, but it could be something that might be useful. There's a lot of functionality in the sheet class (maybe too much?) and so it'd be difficult to extract an interface for it

jasonswearingen commented 1 month ago

props to you @anmcgrath ! I actually didn't see your initial reply to my message, glad you kept track of it :D