Giter Club home page Giter Club logo

colvis's Introduction

Legacy repository

Please note that this is a legacy repo for DataTables. The main source repo is DataTables/DataTablesSrc.

Our distribution repos (for NPM, Nuget, etc packages) are the DataTables/Dist-* repos - e.g. DataTables/Dist-DataTables. Each distribution repo has a core Javascript file or styling for DataTables or an extension. Please use our download builder to obtain the files you need, including for NPM, Nuget, CDN and download.

DataTables plug-in for jQuery

DataTables is a table enhancing plug-in for the jQuery Javascript library, adding sorting, paging and filtering abilities to plain HTML tables with minimal effort. The stated goal of DataTables is:

To enhance the accessibility of data in HTML tables.

To meet this goal, DataTables is developed with two distinct groups of users in mind:

  • You the developers using DataTables. For developers DataTables provides a wide array of options for how data should be obtained, displayed and acted upon, along with an extensive API for accessing and manipulating the table.

  • End users. For those using the interface DataTables presents, actions to get the most from the information contained in tables, such as sorting and filtering, along with paging and scrolling of the data in table, are easy to use, intuitive and fast.

Installing DataTables

To use DataTables, the primary way to obtain the software is to use the DataTables downloader. You can also include the individual files from the DataTables CDN. See the documentation for full details.

NPM and Bower

If you prefer to use a package manager such as NPM or Bower, distribution repositories are available with software built from this repository under the name datatables.net. Styling packages for Bootstrap, Foundation and other styling libraries are also available by adding a suffix to the package name.

Please see the DataTables NPM and Bower installation pages for further information. The DataTables installation manual also has details on how to use package managers with DataTables.

Usage

In its simplest case, DataTables can be initialised with a single line of Javascript:

$('table').dataTable();

where the jQuery selector is used to obtain a reference to the table you want to enhance with DataTables. Optional configuration parameters can be passed in to DataTables to have it perform certain actions by using a configuration object as the parameter passed in to the DataTables constructor. For example:

$('table').dataTable( {
  paginate: false,
  scrollY: 300
} );

will disable paging and enable scrolling.

A full list of the options available for DataTables are available in the documentation.

Documentation

Full documentation of the DataTables options, API and plug-in interface are available on the DataTables web-site. The site also contains information on the wide variety of plug-ins that are available for DataTables, which can be used to enhance and customise your table even further.

Support

Support for DataTables is available through the DataTables forums and commercial support options are available.

License

DataTables is release under the MIT license. You are free to use, modify and distribute this software, as long as the copyright header is left intact (specifically the comment block which starts with /*!).

colvis's People

Contributors

augmt avatar ceefour avatar dustinrc avatar iiseymour avatar msimerson avatar potatosalad avatar smithk86 avatar wicker25 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

colvis's Issues

Provide LICENSE file

Please provide LICENSE (or similar) file with explicit information under what license(s) ColVis is distributed.

Thank you!

Restore button together with state saving

When using state saving the restore button uses the visibility settings from the loaded state instead of the original once that was given when creating the DataTable.

I think it makes more sense to use the original once.

groupButtons collection is not being rebuilt on rebuild

rebuild method has following code to clear this.dom.buttons collection:

this.dom.buttons.splice(0, this.dom.buttons.length);

But there is no code to clear this.dom.groupButtons collection, following would do:

this.dom.groupButtons.splice(0, this.dom.groupButtons.length);

As a result, calling rebuild() does not rebuilds checked and indeterminate properties' values on input elements.

Incorrect code for checkbox toggling in jQuery 1.9

In jQuery 1.9, the usage of .attr() and .prop() have changed. See the jQuery 1.9 upgrade guide.

This affects the following pieces of code in ColVis:

For checking a checkbox

Incorrect:

$('input', this.dom.buttons[i]).attr('checked','checked');

Correct:

$('input', this.dom.buttons[i]).prop('checked', true);

For un-checking a checkbox

Incorrect:

$('input', this.dom.buttons[i]).removeAttr('checked');

Correct:

$('input', this.dom.buttons[i]).prop('checked', false);

Create a composer.json to install plugin with composer

Hi,

I am using Composer for my projects and I really loved the possibility to install datatables with composer even if it is more a js project.
Could you include a composer.json so that also can install this plugin with composer ?

thx

Cannot read property 'length' of undefined

On line 434.
I'm using dataTables 1.9.4. Newest TableTools and newest ColVis.

Whenever I'm trying to initialize colVis for any of tables I get this error.

Code for initialization:
var table = $('table.datatable').dataTable()

var colvis = new $.fn.dataTable.ColVis( table );

$( colvis.button() ).insertAfter('div.info');

Call stateChange before the other callbacks

Currently, the stateChange callback is the last function to be called after hiding/showing a column (colVis.js:640).

If stateChange callback is moved to a place before the other callbacks, then an application can know which column was hidden/shown before the table redraws. The main use case for this is when I'm tracking column visibility outside of the dataTables API and need to use it during one of the other callbacks, like createdRow or rowCallback. I add data-* attributes to DOM elements during the other callbacks based on which columns are visible.

Create a package.json for NPM installation

Hi,
We use datatables-colvis as a dependency in our PatternFly toolkit (patternfly.org), however some of our consumers only use NPM to install PatternFly, so they currently can not get the datatables-colvis dependency since there isn't currently an official published NPM package for datatables-colvis.

We are planning on publishing an NPM for datatables-colvis, but it would be ideal if there was an official NPM.

Thanks,
Dave Taylor

$.browser.msie does not work with jQuery 1.9

This line is incompatible with jQuery 1.9:

if ( $.browser.msie && $.browser.version == "6.0" )

From the jQuery 1.9 upgrade guide:

The jQuery.browser() method has been deprecated since jQuery 1.3 and is removed in 1.9. If needed, it is available as part of the jQuery Migrate plugin. We recommend using feature detection with a library such as Modernizr.

It seems the options for resolving this could be:

  1. Require the jQuery Migrate plugin and use the existing code
  2. Require Modernizr, and rewrite this condition as a Modernizr call
  3. Drop IE6 support and remove this block

None are really ideal. I've just commented out this section since we don't need to support IE6 in my project.

[enhancement] Add missing bower.json.

Hey, maintainer(s) of DataTables/ColVis!

We at VersionEye are working hard to keep up the quality of the bower's registry.

We just finished our initial analysis of the quality of the Bower.io registry:

7530 - registered packages, 224 of them doesnt exists anymore;

We analysed 7306 existing packages and 1070 of them don't have bower.json on the master branch ( that's where a Bower client pulls a data ).

Sadly, your library DataTables/ColVis is one of them.

Can you spare 15 minutes to help us to make Bower better?

Just add a new file bower.json and change attributes.

{
  "name": "DataTables/ColVis",
  "version": "1.0.0",
  "main": "path/to/main.css",
  "description": "please add it",
  "license": "Eclipse",
  "ignore": [
    ".jshintrc",
    "**/*.txt"
  ],
  "dependencies": {
    "<dependency_name>": "<semantic_version>",
    "<dependency_name>": "<Local_folder>",
    "<dependency_name>": "<package>"
  },
  "devDependencies": {
    "<test-framework-name>": "<version>"
  }
}

Read more about bower.json on the official spefication and nodejs semver library has great examples of proper versioning.

NB! Please validate your bower.json with jsonlint before commiting your updates.

Thank you!

Timo,
twitter: @versioneye
email: [email protected]
VersionEye - no more legacy software!

Default hide column doesn't work

Hi,

I have a datatable and I'd like to hide one of the columns. I've used "bVisible : false" but it doesn't seem to work.
Below is my code:

var validatedActivitiesTable = $('#validatedActivitiesTable')
                .DataTable(
                        {
                            "sDom" : "<'dt-toolbar'<'pull-left'f><'pull-right'C><'pull-right margin-right-5'l>r>"
                                    + "t"
                                    + "<'dt-toolbar-footer'<'col-sm-6 col-xs-12 hidden-xs'i><'col-sm-6 col-xs-12'p>>",
                            "autoWidth" : true,
                            "bStateSave" : true,
                            "preDrawCallback" : function() {
                                // Initialize the responsive datatables helper once.
                                if (!responsiveHelper_validatedActivitiesTable_col_reorder) {
                                    responsiveHelper_validatedActivitiesTable_col_reorder = new ResponsiveDatatablesHelper(
                                            $('#validatedActivitiesTable'),
                                            breakpointDefinition);
                                }
                            },
                            "rowCallback" : function(nRow) {
                                responsiveHelper_validatedActivitiesTable_col_reorder
                                        .createExpandIcon(nRow);
                            },
                            "drawCallback" : function(
                                    oSettings) {
                                responsiveHelper_validatedActivitiesTable_col_reorder
                                        .respond();
                            },
                            "aoColumns" : [ null, null, null, null, null, null, null, null, null, { "bVisible" : false} , null, null, null, null ],
                            "order" : [ [ 0, "asc" ] ],
                            "fnInitComplete": function() {
                                var oSettings = $('#validatedActivitiesTable').dataTable().fnSettings();
                                for ( var i=0 ; i<oSettings.aoPreSearchCols.length ; i++ ){
                                    oSettings.aoPreSearchCols[i].sSearch = '';
                                }
                            }
                        }).search("").draw(false);

I'm not sure why it doesn't work because I'm pretty sure the syntax is correct. Did I do anything wrong in the code? Please kindly help.

Thank you in advance.

fnRebuild - fnSettings() no longer exists...

It seems the DataTables object doesn't have a fnSettings method anymore. It does have a settings() method. I fixed the code by changing it to this, no idea if this is correct, but it's working for me.

    //nTable = oTable.fnSettings().nTable;
    nTable = oTable.settings()[0].nTable;

add support for i18n

While the button text can freely be set at init time, it seems to me there's no real support for i18n. It would be quite useful if ColVis for example used DataTables' i18n facility.

Use of <button> element in Show / Hide list breaks in Firefox

In Firefox 4.0.1 click events on a <button> element do not get propagated down to child input elements. This is expected since the the (button standard)[http://www.w3.org/TR/html4/interact/forms.html#h-17.5] does not allow for nesting of <input> fields inside a button.

This means that clicks on the <button> element in the Show / Hide dropdown list do not change the <input type='checkbox>
settings. I would suggest switching the <button> over to a <div> and applying styling manually or removing the checkbox and storing column-visibility state elsewhere.

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.