ERROR: oSettings is null - Page 2

ERROR: oSettings is null

2»

Replies

  • jorgevima74jorgevima74 Posts: 32Questions: 0Answers: 0
    In fact, when I try the "ORDER BY" the first rows in that result have the "Comentarios" field with multiples lines, so...

    Att.
    Jorge.
  • allanallan Posts: 63,407Questions: 1Answers: 10,453 Site admin
    Thanks for your e-mail - yes I agree. I think the newlines are what is causing the issue here. Try replacing them in your PHP with just a space and hopefully it will then all start to magically work :-)

    Allan
  • jorgevima74jorgevima74 Posts: 32Questions: 0Answers: 0
    Allan, I've just replaced the newlines but it doesn't still work:

    $comments=str_replace("\n"," ",$aRow['Comentarios']);
    $comments=str_replace("
    "," ",$aRow['Comentarios']);

    You can refresh the URL again to see the first pages is the only one that is printed on web :(


    Att.
    Jorge.
  • jorgevima74jorgevima74 Posts: 32Questions: 0Answers: 0
    Allan, If I add:

    "fnServerData": function ( sSource, aoData, fnCallback ) {
    ...............
    }

    It cannot run... again!!!! :'(


    Att.
    Jorge.
  • jorgevima74jorgevima74 Posts: 32Questions: 0Answers: 0
    Reviewing your anwers...
    >> The json output looks fine, as does the PHP - so I guess I'm missing something on my read through. The only thing I'm wondering about is where is the "sLimit" variable on the SQL query...

    What do you mean???? I used your example:

    /* Paging */
    $sLimit = "";
    if ( isset( $_GET['iDisplayStart'] ) )
    {
    $sLimit = "LIMIT ".mysql_real_escape_string( $_GET['iDisplayStart'] ).", ".
    mysql_real_escape_string( $_GET['iDisplayLength'] );
    }


    Att.
    Jorge.
  • jorgevima74jorgevima74 Posts: 32Questions: 0Answers: 0
    Allan, news!!!! The problem was in the "\r":

    $comments=str_replace("\r","",$comments);

    Now I see all pages but I'm still in problems... other problems. With fnRowCallback I set the 'id' to TR and TD, and set the CSS classes, anything of that is printed.
    In addition, if add fnServerData, the datatable isn't printed.

    Att.
    Jorge.
  • allanallan Posts: 63,407Questions: 1Answers: 10,453 Site admin
    Ah ha! Those pesky \n and \r's... Always getting in the way. Nice one getting that sorted.

    I'm not sure I understand your second comment though. Looking at your page the ID's of the TDs are being set correctly are they not?

    Also if fnServerData() isn't displaying anything, then you probably aren't calling the call back function correctly. Have a look at the demo page and see if there is any difference to your code.

    Allan
  • jorgevima74jorgevima74 Posts: 32Questions: 0Answers: 0
    Allan, I've just got set the IDs. Before use sAjaxSource I use fnUpdate+fnDraw to refresh datatable with the news values edited but now the fields aren't refreshed. How can I refresh the datatable with the new datas???

    Att.
    Jorge.
  • jorgevima74jorgevima74 Posts: 32Questions: 0Answers: 0
    The same problem I have when I create a new row with fnAddData. Since I use sAjaxSource it doesn't work.
    So, working with server-side, how can I redraw the edited and new rows????

    Att.
    Jorge.
  • allanallan Posts: 63,407Questions: 1Answers: 10,453 Site admin
    With server-side processing most of the API functions which manipulate data will not work - the simple reason is that they all work on the client-side and not the server. Server-side programming and vary greatly from platform to platform (even on the same platform) and adding this kind of thing into the API functions would be far to constrictive, so it's up to the developer to manipulate the data on the client-side and communicate this to the server-side.

    Taking the addition of data to a table as an example, what you will need to do is send the new data you want to be added to the server, it will then add it to isn't database (or do whatever it needs to do) and then call fnDraw() on the client-side to get the updated information from the server-side's database.

    It might be worth reviewing the various server-side processing examples that I've put up: http://datatables.net/1.5-beta/examples/server_side/server_side.html

    Allan
  • jorgevima74jorgevima74 Posts: 32Questions: 0Answers: 0
    If I understood right I can't get the refreshing functionality working with AJAX than working with fnUpdate???? :(

    Att.
    Jorge.
  • allanallan Posts: 63,407Questions: 1Answers: 10,453 Site admin
    You can - you can do everything you want to do with the server-side processing, it just takes a bit more effort. All your updates need to be sent to the server and then the table redrawn (you can update the table live, but that is even more complexity).

    Refreshing the table with server-side processing is simply a case of calling fnDraw() (it will pull updated information from the server).

    Allan
  • jorgevima74jorgevima74 Posts: 32Questions: 0Answers: 0
    Allan, if I add the next to datatable definition, the table stand by "Processing..." and doesn't print it. I just want to get the iDisplayLength and iDisplayStart. What's wrong???

    "fnServerData": function ( sSource, aoData, fnCallback ) {
    for (i=0;i
  • allanallan Posts: 63,407Questions: 1Answers: 10,453 Site admin
    You aren't using the callback function (it needs to be called with the data that you have got from the server) and you don't actually do anything to get new data from the server.

    Take a look at this example: http://datatables.net/1.5-beta/examples/server_side/post.html

    Allan
  • jorgevima74jorgevima74 Posts: 32Questions: 0Answers: 0
    Allan, my datatable is now working fine. But I have a last question.
    After this change you said me for seeing an image instead of "Loading..."
    //oSettings.nProcessing.appendChild( document.createTextNode( oSettings.oLanguage.sProcessing ) );
    oSettings.nProcessing.innerHTML = oSettings.oLanguage.sProcessing;

    I see it with a border and I would like to take it out. It is possible???

    Jorge.
  • allanallan Posts: 63,407Questions: 1Answers: 10,453 Site admin
    Hi Jorge,

    Sounds like you are nearly there - nice one.

    The border on the processing element is a nice easy one to fix - have a look in my demo css file for a style class of 'dataTables_processing'. You will see it has a border - just rip this line out.

    Firebug is a Firefox extension which makes this kind of thing exceptionally easy to find and fix. Webkit's Web Inspector does the same job in Safari / Chrome.

    Hope that helps,
    Allan
  • jorgevima74jorgevima74 Posts: 32Questions: 0Answers: 0
    Thanks Allan. I've modified 'border' and 'padding' and now is perfect ;)

    Jorge.
  • jorgevima74jorgevima74 Posts: 32Questions: 0Answers: 0
    One more question Allan. How can I set the focus on the searching input box????

    Thanks.
    Jorge.
  • allanallan Posts: 63,407Questions: 1Answers: 10,453 Site admin
    Hi Jorge,

    I think:

    [code]
    $('#{_TABLE_ID_}_filter input').focus();
    [/code]

    should do that for you.

    Allan
  • jorgevima74jorgevima74 Posts: 32Questions: 0Answers: 0
    Allan, it isn't running :(

    Jorge.
  • allanallan Posts: 63,407Questions: 1Answers: 10,453 Site admin
    Perhaps this will:

    [code]
    $('#{_TABLE_ID_}_filter input')[0].focus();
    [/code]

    And remember to change "{_TABLE_ID_}" to whatever is needed.

    Allan
  • jorgevima74jorgevima74 Posts: 32Questions: 0Answers: 0
    Perfect!!! It's running ;)

    Thank you very much.

    Jorge.
This discussion has been closed.