🔔 Alert..!! Get 2 Month Free Cloud Hosting With $200 Bonus From Digital Ocean ACTIVATE DEAL

ASH (Avoid Selectors Hell) is an extremely lightweight jQuery plugin that provides several methods to toggle the visibility of your table columns.


Documentation

ASH Native script && jQuery Plugin

Avoid Selectors Hell - is an extremely tiny tool to simplify work with columns in tables

jQuery demo: http://tryshchenko.com/samples/ash/ Native js demo: http://tryshchenko.com/samples/ash-native/

How to use jQuery version

You can use a pretty syntax for your operations:

$('table').hideColumn(3);

Also you can pass arguments to 'hideColumn', 'toggleColumns', or 'showColumn' functions. You can use 'slow', 'fast', 400 or any other values available for 'hide', 'toggle' and 'show' methods.

    $('table').hideColumn(1, 'fast');     $('table').showColumn(1, 400);     $('table').toggleColumn(3, 'fast');

All these expressions is correct.

Library also provides a simple helper to select column:

    $('table').getColumn(2); //it's is a jQuery object.     //For example:      $('table').getColumn(2).css('color', 'red');     $('table').getColumn(2).addClass('active');     $('table').getColumn(3).remove();

How to use a native version

Basicaly script provides the similar API:

	ash.get('.table').hideColumn(4);

As you can understand - difference is in table selection process: in this case ASH handles selectors instead of jQuery.

	ash.get('.table').showColumn(2); 	ash.get('.table').toggleColumn(3); 	ash.get('.table').hideColumn(2);

Library also provides a simple helper to select column. In case of native library you should use native modifiers:

    var cells = ash.get('.table').getColumn(3); //it's is a js DOM object.     //For example:  	for (var i = 0; i < cells.length; i++) { 		cells[i].style.color = 'green'; 	}

It's a tiny helpers useful for me, and I'll be happy if it will help you.


You May Also Like