Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter 1punkt0

    (@1punkt0)

    Hey Tobias,

    thank you for your time, i appreciate it a lot!
    I’ll check out the correct inserting of code into the custom commands, though for now/today i’m out.

    Thanks and all the best
    Nielz

    Thread Starter 1punkt0

    (@1punkt0)

    Oh, sorry, i forgot to mention, that i tried to add this to the „Custom Commands“, but there i only get stuff like

    "columnDefs": [ { "type": "formatted-num", "targets": [ 0 ] } ]
    

    to work and not that code above. Are there any documentations or examples for the code provided by datatables.net-site to use in the custom commands-field?

    Thread Starter 1punkt0

    (@1punkt0)

    Thanks for your quick reply.
    But nope, that didn’t solved the problem, i already tried that.

    Maybe you can give me another hint: how do i get these code-snippets from the datatables.net site to work, like this:

            drawCallback: function () {
              api = this.api();
              var arr = api.columns(2).data()[0].map(function(x) { return x.split(' ')[0] });  //get array of column 3 (extn)
              //var arr = api.columns(2).data()[0];  //get array of column 3 (extn)          
              console.log("ARR: " + arr);
              var sorted = arr.slice().sort(function(a,b){return b-a});
              var ranks = arr.slice().map(function(v){ return sorted.indexOf(v)+1 });
              console.log("SORTED: " + sorted);
              console.log("RANKS: " + ranks);
              // interate through each row
              api.rows().every( function ( rowIdx, tableLoop, rowLoop ) {
                var data = this.data();
                var n = data.extn.split(' ')[0];
                console.log("XX " + data.extn +" : " + ranks[arr.indexOf(n)]);
                data.rank = ranks[arr.indexOf(n)];  //set the rank column = the array index of the extn in the ranked array
                //$('#example tbody tr:eq('+rowIdx+') td:eq(4)').html(ranks[arr.indexOf(data.extn)]);
                this.data(data);
                    
                  
                  } );
    
    //            api.rows().invalidate();
              }

    It fires js-errors …

Viewing 3 replies - 1 through 3 (of 3 total)