Atuksharma / jquery-datatables-column-filter

Automatically exported from code.google.com/p/jquery-datatables-column-filter
0 stars 0 forks source link

Compatibility with ColReorder [Fixed] #128

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Activate bAutoSave, using ColRorder and ColVis
2. Define a column (say A) as select type, and another (say B) as text type.
3. Reorder both columns.
4. Reload the Site

What is the expected output? What do you see instead?
Expected: The filters behind the correct column: A select filter below column 
A, and a text filter below column B.
Actual: The select filter below column B and the text filter below column A.

What version of the product are you using? On what operating system?
datatables 1.9, column filter 1.5.1, ColReorder 1.0.8

What I did to fix it:
- Defined a property named bUseColReorder (the same type as bUseColVis).
- Just before the line "$(aoFilterCells).each(function (index) {//fix for 
ColVis", added the following block:

            if (properties.bUseColReorder) {
              var aColumnOrder = [];
              for ( var counter=0, counterLen = oTable.fnSettings().aoColumns.length ; counter<counterLen ; counter++ )
              {
                aColumnOrder.push( oTable.fnSettings().aoColumns[counter]._ColReorder_iOrigCol );
              }
            }

- Substituted the line:
                      aoColumn = properties.aoColumns[i];
  with:
if (properties.aoColumns.length < i || properties.aoColumns[i] == null)
                        return;
                    if (properties.bUseColReorder) {
                      aoColumn = properties.aoColumns[aColumnOrder[i]]
                    } else {
                      aoColumn = properties.aoColumns[i];
                    }

That's it.

Original issue reported on code.google.com by esmigue...@gmail.com on 30 Jun 2013 at 1:18