LumaPictures / meteor-jquery-datatables

Sort, page, and filter millions of records reactively.
http://jquery-datatables.meteor.com
MIT License
98 stars 29 forks source link

colReorder state save/load error #19

Closed gjolund closed 3 years ago

gjolund commented 10 years ago

The following console error is thrown when loading a table state that has reordered columns ( colReorder extension )

To replicate ( assumes meteor / meteorite / node installation )

$ git clone https://github.com/lumapictures/meteor-jquery-datatables
$ cd meteor-jquery-datatables
$ git checkout stateSave
$ cd example
$ mrt add jquery-datatables
$ meteor

Go to http://localhost:3000/column-reorder and check the console, you'll see:

Exception from Deps recompute function: TypeError: Cannot read property '_ColReorder_iOrigCol' of undefined
    at Object.ColReorder._fnStateSave (http://localhost:3000/packages/jquery-datatables.js?f5e10cc4d9dddab2d0d17445b421e10c7be210a4:16294:74)
    at null.<anonymous> (http://localhost:3000/packages/jquery-datatables.js?f5e10cc4d9dddab2d0d17445b421e10c7be210a4:16185:22)
    at http://localhost:3000/packages/jquery-datatables.js?f5e10cc4d9dddab2d0d17445b421e10c7be210a4:5029:19
    at Function.jQuery.extend.map (http://localhost:3000/packages/jquery.js?265926494aaa3929cd2e30da265211c5929f37a4:544:13)
    at _fnCallbackFire (http://localhost:3000/packages/jquery-datatables.js?f5e10cc4d9dddab2d0d17445b421e10c7be210a4:5028:12)
    at _fnSaveState (http://localhost:3000/packages/jquery-datatables.js?f5e10cc4d9dddab2d0d17445b421e10c7be210a4:4757:3)
    at http://localhost:3000/packages/jquery-datatables.js?f5e10cc4d9dddab2d0d17445b421e10c7be210a4:5029:19
    at Function.jQuery.extend.map (http://localhost:3000/packages/jquery.js?265926494aaa3929cd2e30da265211c5929f37a4:544:13)
    at _fnCallbackFire (http://localhost:3000/packages/jquery-datatables.js?f5e10cc4d9dddab2d0d17445b421e10c7be210a4:5028:12)
    at _fnDraw (http://localhost:3000/packages/jquery-datatables.js?f5e10cc4d9dddab2d0d17445b421e10c7be210a4:2007:3) 

The variable scope when the error is thrown is:

statesave_code

Table config options ( these are merged together when passed into datatables ):

    display:
      # ##### Bootstrap 3 Markup
      # You can change this by setting `Template.dataTable.defaultOptions.sDom` property.
      # For some example Less / CSS styles check out [luma-ui's dataTable styles](https://github.com/LumaPictures/luma-ui/blob/master/components/dataTables/dataTables.import.less)
      sDom: "<\"datatable-header\"Rfl><\"datatable-scroll\"rt><\"datatable-footer\"ip>"

    pagination:
      sPaginationType: "full_numbers"
      oLanguage:
        sSearch: "_INPUT_"
        sLengthMenu: "<span>Show :</span> _MENU_"
        # ##### Loading Message
        # Set `oLanguage.sProcessing` to whatever you want, event html. I haven't tried a Meteor template yet, could be fun!
        sProcessing: "Loading"
        oPaginate:
          sFirst: "First"
          sLast: "Last"
          sNext: ">"
          sPrevious: "<"

    stateSave:
      stateSave: true
      stateSaveParams: ( settings, data ) ->
        console.log 'save params'
        console.log settings
        console.log data
      stateLoaded: ( settings, data ) ->
        console.log 'loaded'
        console.log settings
        console.log data
      stateLoadParams: ( settings, data ) ->
        console.log 'load params'
        console.log settings
        console.log data

Seems to only be a problem with column reorder, colvis and the default tables seem to work fine.

timothymarois commented 10 years ago

Having the same issue here. Uncaught TypeError: Cannot read property '_ColReorder_iOrigCol' of undefined,

This Bug should actually be on DataTables