eisenbraun / columns

A jQuery plugin that converts JSON data into searchable, sortable, HTML tables
http://eisenbraun.github.io/columns
MIT License
104 stars 47 forks source link

Get the json of the full table after filtering. #13

Closed sanurocks closed 9 years ago

sanurocks commented 9 years ago

Is there any way to get the columns data after the filter has been applied. as per the documentation getRows return only the current page rows, How to extract all rows after filter has been applied.

eisenbraun commented 9 years ago

There is no API Method to get all rows, but depending on what you are trying to do, there maybe a couple of work arounds you could do.

First, if you want to just show all rows, you can turn off pagination by using the option paginating: false during initialization.

If you want the data results after filtering, you can create a plugin like this

if (typeof ColumnsPlugins === 'undefined') var ColumnsPlugins = {};

ColumnsPlugins.filterdata = {
    init: function() {
        //do nothing
    },

    create: function() {
        /***
            By manually reseting data and filtering in this way will give you
            the filtered data only, but will have no affect on the table from
            being displayed.

            Access the reset and filtered data through this.data
        ***/
        this.resetData();
        this.filter();

        //log the filtered data
        console.log(this.data);
    }
}

If you want the formatted row, unfortunately, there is no way of manually retrieving the formatted rows without displaying the rows.

I hope this make sense. Please let me know if you have any questions.

sanurocks commented 9 years ago

Thanks that solves it.