gridster.js icon indicating copy to clipboard operation
gridster.js copied to clipboard

adding "disabled" class to grid wrapper when grid instance is disabled

Open imMiles opened this issue 12 years ago • 4 comments

A suggestion on minor improvement: Adding "disabled" class to grid wrapper when grid instance is disabled. This feature can provide convenience in many aspects, e.g., cursors for disabled grids can be controlled by css without writing javascripts.

imMiles avatar Mar 21 '13 08:03 imMiles

I use the "static" class for disabled widgets currently by default. Are you suggesting that we disable elements entirely?

On Thu, Mar 21, 2013 at 1:26 AM, imMiles [email protected] wrote:

A suggestion on minor improvement: Adding "disabled" class to grid wrapper when grid instance is disabled. This feature can provide convenience in many aspects, e.g., cursors for disabled grids can be controlled by css without writing javascripts.

Reply to this email directly or view it on GitHub: https://github.com/dustmoo/gridster.js/issues/5

dustmoo avatar Mar 21 '13 13:03 dustmoo

Perhaps it is better to explain in the following example:

There are 2 modes for the grids, the view-only mode for end-users, and the design mode for editors.

In the view-only mode, grids are disabled (gridster.disable()), and cannot be dragged at all.

In the design mode, all grids except the static ones can be dragged. Now, we need something to indicate the static ones cannot be dragged (in my case, I would like to set their CSS cursor to “not-allowed”).

So, CSS stylesheet should look like this:

.disabled .gs_w{ cursor:default !important; } .gridster .static{ cursor:not-allowed; }

That's why I suggest add "disabled" class to the grid wrapper.

imMiles avatar Mar 26 '13 02:03 imMiles

One more thing, I think, by default the grid should not be enabled after initialized.

For business purpose, the viewer is not supposed to change the grid layout. Only in design mode can the administrator of the grid change the layout after "gridster.enable()".

Enabling the grid by default wastes a little time in javascripts, in most cases.

imMiles avatar Mar 26 '13 02:03 imMiles

Thanks ImMiles. I am clearer as to the purpose of the disabled class, and that certainly makes sense. As for disabled by default, that could easily be an option that users can pass, as I think it is dependent on the use-case. In my product the user interacts directly with the grid and it is never disabled.

That said I'll see about adding the option.

dustmoo avatar Mar 26 '13 14:03 dustmoo