Changing from 1.5.6 to 1.7.3 causing issues

Changing from 1.5.6 to 1.7.3 causing issues

PummraPummra Posts: 20Questions: 0Answers: 0
edited October 2010 in General
I am working on an old project which was using an older version of DataTables.

I was trying to get a few filtering bits working so decided to upgrade to the latest version however this has caused a few more issues!

this is my filtering code:
[code]
$('#filter').keyup(function() {
oTable.fnFilter( $(this).val(), 1 );
$('#player_table_wrapper').jScrollPane();
});
[/code]

works fine in 1.5.6 but does nothing in 1.7.3! The issues I was having in 1.5.6 was trying to do a reverse filter using Regex as I have seen suggested on this forum before, that wouldn't work in 1.5.6 at all!

Another issue, although not the end of the work in 1.7.3 when ever i use:

[code]
oTable.fnSetColumnVis( i, false );
[/code]

My Web Development Toolbar throws up the following issues:

[code]
Warning: Selector expected.
Source File: http://localhost/drafts
Line: 0
[/code]

Anyone know why the filtering wouldn't be working in the latest version, pulling my hair out here - and I don't have a lot of it left! :)

Thanks

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    The filtering API for regex has changed slightly to make it easier to do your own regex stuff. A summary of the changes can be found here: http://datatables.net/upgrade/1.7 . Also of course the docs will help: http://datatables.net/api#fnFilter .

    However, the call you've got to fnFilter above most certainly should work! As can be seen in this example, http://datatables.net/examples/api/multi_filter.html the call I've got is the same (string, int) and that is okay. Could you post a link to your page which doesn't work please?

    Likewise with the fnSetColumnVis - I've not seen that error before, so if you could give us a link to see this in action, that would make debugging much easier.

    Thanks,
    Allan
  • PummraPummra Posts: 20Questions: 0Answers: 0
    I am developing locally so have ripped just the table out of the code and put it up here to test:

    http://www.mikej.co.uk/test.htm

    Still getting the same errors, I'll keep digging to see if I can find what the issue is (its probably something simple)!
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Thanks for putting up the example. With the fnFilter call, it's not going to work because you've not got filtering enabled (bFilter)! If you want to keep filtering enabled, but not have DataTables put in the filtering element, just take it out of sDom: http://datatables.net/usage/options#sDom (the 'f' option).

    The fnSetColumnVis seems to me works okay for me in the example you've put up there. Could you confirm what browser / platform you are using?

    Allan
  • PummraPummra Posts: 20Questions: 0Answers: 0
    Brilliant! Thanks, knew it would be something simple. Filtering is working perfectly now (yey).

    In regards to the issue with fnSetColumnVis, its not an issue in that it stops JS from firing, it works and does hide the column correctly. Its just an warning that appears in the Error Console when using the Web Developer Toolbal on Firefox.

    I'm running FF 3.6.10

    Thanks again!
  • PummraPummra Posts: 20Questions: 0Answers: 0
    Just remembered another question in regards to filtering.

    If I wanted to only filter a specific part of a cell is that possible?

    For example my cells have data in as follows

    Player (position - team)

    I only want to filter on the player name and ignore the position/team. Is it possible to specific HTML tags to search within? Or would I need to do it in RegEx?

    Cheers
  • PummraPummra Posts: 20Questions: 0Answers: 0
    I am now getting another problem with filtering and using RegEx.

    If I enter the following in to the text box:

    Ash.*\(.*\) it searches fine and works as expected. If I move .*\(.*\) to be added automatically to the search string it doesn't work.

    Test up on the same page, two text boxes to demonstrate the problem.
  • PummraPummra Posts: 20Questions: 0Answers: 0
    Ignore me I am a dunce, forgot to escape my escapes in the RegEx!
This discussion has been closed.