Attempt to integrate with "Live Game Server List"

Attempt to integrate with "Live Game Server List"

KIKOFFKIKOFF Posts: 4Questions: 0Answers: 0
edited November 2010 in General
Hi all, I'm trying to integrate "DataTables" with a PHP application called LGSL "Live Game Server List" by Richard Perry http://www.greycube.com
Everything works fine, paging, searching, sorting and filtering.

The problem I have is when I filter or search for a game, such as "Battlefield 2". As a result throws me, not only "Battlefield 2". Also casts "Battlefield 1942", "Battlefield 2142" and Battlefield Bad Company 2.

Is any chance to throw the exact result? I searched the forum but I see no possibility. Any help to this novice, will be well recived.

Greeting, KIKOFF
PD: Sorry for my bad English, I hope you understand my request.

Replies

  • KIKOFFKIKOFF Posts: 4Questions: 0Answers: 0
    Nobody can help me?

    Thanks in advance, KIKOFF
  • StephanStephan Posts: 20Questions: 0Answers: 0
    Hi,
    may be this can help you out (http://datatables.net/api):

    fnFilterParameters:
    1. string : String to filter on.

    2. int (optional): Column to limit filtering to - default null. Note that the column counting index starts at zero.

    3. boolean (optional): Treat the string as a regular expression (true), or as a standard string (false). Default false

    4. boolean (optional): Enable smart filtering or not. When Smart filtering is enabled, DataTables will attempt to use regular expressions to match the input words over multiple points in the data (rather than as a simple string). This regular expression however, can interfere with your own, so it can be useful to disable. Default - true

    5. boolean (optional): Show the filter in the global input box used for filtering (only used for global filtering, not column filtering). Default - true

    So you could use a fnFilter-call with smart filtering set to false for your specific column. May be this should do the trick. Hope this ppoints you to the right direction.

    If you use serverside processing you could rewirte your columnfilter handling for the column regarding wildcards....
  • KIKOFFKIKOFF Posts: 4Questions: 0Answers: 0
    edited December 2010
    Hi Stephan, thanks for answering. But I am not able, i do not know how to develop.
    I use a select to filter the second column (line 10), here the code:
    [code]$(document).ready(function() {
    var oTable = $('#gamemonitor').dataTable( {
    "bProcessing": true,
    "sDom": '<"top"fr>rt<"bottom"lip><"clear">',
    "sPaginationType": "full_numbers",
    "aaSorting": [[ 5, "desc" ]],
    "bInfo": true,
    "aoColumns": [
    { "bSearchable": false, "bSortable": false },
    { "sType": "html" },
    { "sType": "ip-address" },
    { "sSortDataType": "dom-text" },
    { "sSortDataType": "dom-text" },
    { "sType": "percent" }
    ],
    "oLanguage": {
    "sLengthMenu": "Mostrar _MENU_ por página",
    "sZeroRecords": "No se ha encontrado nada - realize otra busqueda",
    "sInfo": "Mostrando de _START_ a _END_ de _TOTAL_ servidores",
    "sInfo": "Mostrando de _START_ a _END_ de _TOTAL_ servidores",
    "sInfoEmpty": "Mostrando de 0 a 0 de 0 servidores",
    "sInfoFiltered": "(filtrado de _MAX_ servidores en total)",
    "sSearch": "Buscar:",
    "oPaginate": {
    "sFirst": "Primera",
    "sLast": "Ultima",
    "sNext": ">>",
    "sPrevious": "<<"
    }
    }
    } );
    $("tfoot th").each( function ( i ) {
    this.innerHTML = fnCreateSelect( oTable.fnGetColumnData(i) );
    $('select', this).change( function () {
    oTable.fnFilter( $(this).val(), i );
    } );
    } );
    } );[/code]
    If possible and would be so kind to help me, would greatly appreciate it.

    Greetings, KIKOFF
  • StephanStephan Posts: 20Questions: 0Answers: 0
    edited December 2010
    Hey,

    i don't have much time at the moment. But looking here http://www.datatables.net/examples/api/regex.html - i guess you need to disable smart filter...
    parameters for fnFilter:
    ...
    4. boolean (optional): Enable smart filtering or not. When Smart filtering is enabled, DataTables will attempt to use regular expressions to match the input words over multiple points in the data (rather than as a simple string). This regular expression however, can interfere with your own, so it can be useful to disable. Default - true

    [code]
    $("tfoot th").each( function ( i ) {
    this.innerHTML = fnCreateSelect( oTable.fnGetColumnData(i) );
    $('select', this).change( function () {
    oTable.fnFilter( $(this).val(), i, false, false);
    } );
    } );
    [/code]
  • KIKOFFKIKOFF Posts: 4Questions: 0Answers: 0
    Hi Stephan, thank you very much for your help. I disabled bSmart, I've also replaced the code you gave me
    [code]oTable.fnFilter( $(this).val(), i, false, false);[/code]
    Now much better filter, for example if I select Battlefield 2, Battlefield 2142 also shows. Not so bad, before showing all versions of Battlefield.
    If possible make it more precise, when you have availability, of course. I am grateful for your help.

    Greetings, KIKOFF.
This discussion has been closed.