fullstackhero / blazor-wasm-boilerplate

Clean Architecture Boilerplate Template for .NET 6.0 Blazor WebAssembly built for FSH WebAPI with the goodness of MudBlazor Components.

Home Page:https://fullstackhero.net/blazor-webassembly-boilerplate/general/getting-started/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Move Dense, Bordered and Striped to the ThemeManager Pane

fretje opened this issue · comments

Having those 3 switches on every table is a sore on the eye (it makes the first column wider than it has to be and it's totally messed up when the first column isn't wide enough anymore).

I think these would fit perfectly in the ThemeManager SidePanel as user-configurable global settings for all the tables in the app (at least those that subscribe to the changes of those properties)

Yeah, I have actually tried this earlier. But the issue is after storing these values to localStorage (like other settings), how do we make the table component retrieve and refresh these changes.

We could have these settings in a global "themesettings" cascading value which has these properties to bind against?

Not sure if Cascading Values allow two-way binding. It only can transfer data from parent to child components.

In our case, the flow would be like this

ThemeManager Component --> Parent (MainLayout Probably) --> EntityTable Component

Hmm jep... I didn't say it was gonna be easy :-D

I'm sure there must be a way... isn't this what blazor is all about? ;-)

Maybe we should post the question on the mudblazor repo or discord...

Probably can be a mix of EventCallBack and CascadingParams. Will try.

waj on discord mentioned something that might be interesting;

have a look at this https://github.com/aksoftware98/blazor-utilities
we can subscribe to get updates on theme settings

If we were to use this, then from ThemeManager pane you can just send update messages (updateDense, updateBordered and updateStriped (for instance) with their respective values).
We can then maybe create an FSHTable which derives from MudTable (similar like I made BrandsAutocomplete) which takes care of subscribing and responding to these messages?
Then we just replace <MudTable> everywhere with <FSHTable>...

Do review this. May require minor cleanups