Giter VIP home page Giter VIP logo

colresize's Introduction

colResize 0.0.3

A DataTables plugin for dynamic resizing of columns

Requires: DataTables 1.10.2 or greater

Installation

To use ColResize, first download DataTables ( http://datatables.net/download ) then download dataTables.colResize.js into an extensions directory in the DataTables package.

Basic usage

ColResize is initialised using the Z option that it adds to DataTables' dom option. For example:

$(document).ready( function () {
	$('#example').dataTable( {
		"dom": 'Zlfrtip'
	} );
} );

ColResize supports both fixed width tables and variable width tables. Fixed width table splits the column width difference between itself and its neighbour column. Variable width tables increase/decreases the width of the table the same amount as the column being resized. By default it is fixed width, for variable set tableWidthFixed to false:

$(document).ready( function () {
	$('#example').dataTable( {
		"dom": 'Zlfrtip',
		"colResize": {
			"tableWidthFixed": false
		}
	} );
} );

ColResize has right to left(rtl) support. This changes which neighbouring column is resized. Make sure the table is set to rtl as well otherwise this property will not work. For right to left set rtl to true:

$(document).ready( function () {
	$('#example').dataTable( {
		"dom": 'Zlfrtip',
		"colResize": {
			"rtl": true
		}
	} );
} );

To exclude columns from resizing simply add the index to the exclude array.

$(document).ready( function () {
	$('#example').dataTable( {
		"dom": 'Zlfrtip',
		"colResize": {
			"exclude": [0,1,2]
		}
	} );
} );

You can set a callback function for when the user is done resizing.

$(document).ready(function() {
	$('#example').DataTable( {
		"dom": 'Zlfrtip',
		"colResize": {
			"resizeCallback": function(column) {
				alert("Column Resized");
			}
		}
	} );
} );

You can adjust the width of the resize handle (in px).

$(document).ready(function() {
	$('#example').DataTable( {
		"dom": 'Zlfrtip',
		"colResize": {
			"handleWidth": 10
		}
	} );
} );

colresize's People

Contributors

dykstrad avatar

Watchers

James Cloos avatar Licia Hawking avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.