mleibman / SlickGrid

A lightning fast JavaScript grid/spreadsheet
http://wiki.github.com/mleibman/SlickGrid
MIT License
6.81k stars 1.98k forks source link

Issues with merging slickgrid stylesheets #1110

Open sodlum opened 8 years ago

sodlum commented 8 years ago

I have a use case that requires a lot of different instances of a slick grid loaded to the page all at once. Normally, this wouldn't be a problem, but IE9 has a hard limit of 31 (IE8 has 24?) concurrent stylesheets and each instance of a slick grid creates a new stylesheet.

I was partially able to merge the stylesheets that each instances creates into one single sheet, but that caused some styling issues with the rows not being properly aligned when adding new rows to a grid. Only the last grid has it's rows properly formatted. I've attached a screenshot showing the issue. grids

The main change I've made to the stylesheet creation is below.

if ($('.style_sheet').length == 0) {
    var styleNode = $('<style type="text/css" rel="stylesheet" class="style_sheet" />').appendTo($('head')).get(0);
} else {
    var styleNode = $('.style_sheet').get(0);
}

Which was changed from just:

var styleNode = $('<style type="text/css" rel="stylesheet"/>').appendTo($('head')).get(0);

I'm also making sure to append the css to the cssText property for IE instead of overwrite it. That particular part isn't an issue in other browsers since they use .appendChild() to create a text node.

Is there something else I need to change which I'm not seeing? Or perhaps a better way to merge the stylesheets without creating multiple so this isn't an issue?

Thanks!

6pac commented 8 years ago

Not sure if you're familiar with my Alternate Master: https://github.com/6pac/SlickGrid I'd recommend you switch to it.

I applied patches as you suggest, in response to several issue numbers, here: https://github.com/6pac/SlickGrid/commit/a2a5e2cf30a7adaa4908573481274cc57b6a202a

But then later, after more investigation, found that there were serious problems, and reverted the entire patch: https://github.com/6pac/SlickGrid/commit/0145d1a58c5c5e033bbdbe67449a73372c35f568

There's a fair bit of commentary, it's probably worth reading everything before proceeding.

sodlum commented 8 years ago

Thanks for the response, but I guess if the dev himself says that it's not really a practical solution short term, then I will need to find a different approach.

6pac commented 8 years ago

up to you. MLeibman rarely responds these days. the comments I refer to are on the commits I linked to above. The Alternate Master is a bid to keep the project current.