Title: Best Practices: Formatting / Styling DataGrids... Post by: 2plus2 on June 19, 2013, 03:42:28 PM We have a Data Grid that is marginally complex. Merging Cells between rows, and about 15 columns. Grouping the data visually has become an issue in order to provide the fastest way to view the data.
We are thinking that column lines might be important in these visual groupings, applying them as end-caps to the grouped columns. e.g. front of column 6, and back of column 8, etc. First question: How are others styling the Data Grids to visual group information? Second question: Is there an equivalent to styler for adding a class instead of inline CSS? I would prefer to have a CSS Class that I can update centrally than a bunch of inline-styles. (Granted I could use a centralized function call, but if it's a class the designers can update it themselves. Title: Re: Best Practices: Formatting / Styling DataGrids... Post by: jpierce on June 19, 2013, 08:04:40 PM Funny, I was just coming here to suggested a version of styler that would expect a CSS class to apply. It seems like a much better practice when you're applying the same styles all over the place. I have some users that are okay to be messing with the css file but who I don't want screwing up the javascript.
They could easily make it where if the styler function returns a single string with no colon, it's expected to be a css class name(s) to apply. Title: Re: Best Practices: Formatting / Styling DataGrids... Post by: stworthy on June 19, 2013, 08:24:38 PM Here is the solution to return class name in 'styler' function. First of all extend or override the 'renderRow'.
Code: $.extend($.fn.datagrid.defaults.view,{ The usage examples: Code: // return both class name and inline styles Title: Re: Best Practices: Formatting / Styling DataGrids... Post by: jpierce on June 20, 2013, 07:37:25 AM Very nice and I much appreciate the quick response. I didn't realize you could do it this way. I might tweak it to allow me to just treat a colon-less string as a css class name as well.
|