oSettings.aoPreSearchCols[iColumn] is undefined

oSettings.aoPreSearchCols[iColumn] is undefined

subash22subash22 Posts: 11Questions: 0Answers: 0
edited May 2012 in General
Hello All,

I am using datatables and this is my initialization code

[code]oTable = jQuery('#example').dataTable({
"sDom": 'Rlfrtip',
"bPaginate": true,
"iDisplayStart": 0,
"iDisplayLength": 100,
"iColumns": 7,
"bLengthChange": false,
"bFilter": true,
"bSort": true,
"bInfo": true,
"bAutoWidth": true,
"sScrollY": $('treeColumn').getSize().y -80,
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "./ci_ajax/ci_get_products.php?classification_key="+classification_key+"&catalog_key="+catalog_key,
"fnDrawCallback": function() {
var aoColumns = this.fnSettings().aoColumns;
//console.log(aoColumns);
for (var i=0 ; i

Replies

  • allanallan Posts: 63,546Questions: 1Answers: 10,476 Site admin
    What is:

    > "iColumns": 7,//changed from 6 to 7

    iColumns isn't a parameter that DataTables will pick up. The fact that you have aoColumns with 2 columns in it as well suggests to me that there might be a bit of a problem with the column count.

    Can you link to your page or at least run it through the debugger please? :-)

    Thanks,
    Allan
  • subash22subash22 Posts: 11Questions: 0Answers: 0
    I actually have 7 columns in my table but it will be so long if i write the all columns, so I mentioned only two columns.
    I removed the line iColumns and I am still getting the same error.

    Can u please tell me how to use the API function fnFilterAll, I read the documentation but I could not understand how to do it.
    I have made a file dataTables.fnFilterAll.js and I have included this file in my 'index.php' where I have included the jQuery.dataTables.js.
    Now where should I call this function??
  • allanallan Posts: 63,546Questions: 1Answers: 10,476 Site admin
    This example shows how to use plug-in API methods: http://datatables.net/release-datatables/examples/plug-ins/plugin_api.html . You can call the function from wherever you want, as long as the table has been initialised.

    > I removed the line iColumns and I am still getting the same error.

    Does your code have aoColumns with 2 entries in it - or did you change it for the forum here? As I say, if you could give me a link or at least use the debugger, I might be able to offer a bit more help :-)

    Allan
  • subash22subash22 Posts: 11Questions: 0Answers: 0
    I think now it makes sense about the icolumns and aocolumns.

    Also I am running my code as a localhost so unfortunately i cannot provide any link.
    what do u mean by 'at least use the debugger'??
  • allanallan Posts: 63,546Questions: 1Answers: 10,476 Site admin
    http://datatables.net/forums/discussion/9719 has a link to it :-). http://debug.datatables.net .

    Allan
  • subash22subash22 Posts: 11Questions: 0Answers: 0
    Okkk....I got that.
    Debug Code is ocebom
  • subash22subash22 Posts: 11Questions: 0Answers: 0
    Now I got rid of this error by using this code
    [code]if ( typeof oSettings.aoPreSearchCols[ iColumn ] == 'undefined' ||
    oSettings.aoPreSearchCols[ iColumn ] === null )
    {
    oSettings.aoPreSearchCols[ iColumn ] = {
    "sSearch": "",
    "bRegex": false,
    "bSmart": true
    };
    }[/code]

    But now I am getting new errors
    [code]oSettings is null,this.fnSettings() is null[/code]

    please help any one
  • allanallan Posts: 63,546Questions: 1Answers: 10,476 Site admin
    You are using DataTables 1.7.6 which is quite old now. I'd suggest updating to the latest, 1.9.1, and seeing how that effects what you are doing. If you still get an error there, can you run the debugger on the updated table please (as that will give me more information with 1.9).

    Allan
  • subash22subash22 Posts: 11Questions: 0Answers: 0
    ok...this is the debug code with datatables 1.9.1
    code is 'ufefil'

    Thank u very much for u r help
  • allanallan Posts: 63,546Questions: 1Answers: 10,476 Site admin
    Okay - thanks. I see you are also using old versions of the plug-ins. It would be worth updating them to the latest versions as well - particularly for ColReorder, where you will want to use the nightly to make sure you've got the very latest version: http://datatables.net/download .

    Allan
  • subash22subash22 Posts: 11Questions: 0Answers: 0
    I have updated all the things to the latest versions but i m still getting the same error
    oSettings is null,this.fnSettings() is null

    btw new debug code is ucoqux

    Also thanks for u r quick replies.........
  • allanallan Posts: 63,546Questions: 1Answers: 10,476 Site admin
    Next question - what does your fnFilterAll call look like?
  • subash22subash22 Posts: 11Questions: 0Answers: 0
    [code]$$('#example_filter input').addEvent('keyup', function() {
    oTable.fnFilterAll(this.value);
    });[/code]

    this is my fnFilterAll called after initialization of my datatable
  • allanallan Posts: 63,546Questions: 1Answers: 10,476 Site admin
    Are you unbinding the default keyup event handler? I don't think it would result in the error you are seeing, but worth checking.

    I'm afraid beyond that I'd really need to see an example the error, since as far as I can tell it should be working.

    Allan
  • subash22subash22 Posts: 11Questions: 0Answers: 0
    I didn't unbind the event handlers....
    I have the individual column filters working but the global filter is the only thing not working....
  • subash22subash22 Posts: 11Questions: 0Answers: 0
    ok...thank u very much for u r time...
    do u have any idea about this error???
    [code]sVal.replace is not a function[/code]
  • allanallan Posts: 63,546Questions: 1Answers: 10,476 Site admin
    What line does it occur on. I don't know off the top of my head what the error is there - I would guess that a null value or something is being used a s string. Again, I would need to see a test case to offer any more help.
  • subash22subash22 Posts: 11Questions: 0Answers: 0
    edited May 2012
    when I enter any value in the global search then I am getting an error

    oSettings is null
    this.fnSettings is null

    any idea??
  • allanallan Posts: 63,546Questions: 1Answers: 10,476 Site admin
    Nope no idea. Please give us a link :-)

    Allan
This discussion has been closed.