Editor initialisation is extremely slow

Editor initialisation is extremely slow

scottjenkinsscottjenkins Posts: 5Questions: 1Answers: 0

Hi,

I'm using Editor with PHP server side processing.

Our database has around 70,000 rows.

The initialisation/loading takes at least 1 minute and even sometimes makes the browser go in to not responding.

Is there a way to speed this up?

Thanks,
Scott

Answers

  • allanallan Posts: 61,805Questions: 1Answers: 10,119 Site admin

    1 minute is exceptionally slow! You note you are using server-side processing, have you set DataTables to make a POST request (assuming you are processing POST parameters in the PHP).

    There is an example of that shown here.

    Beyond that, perhaps you could show me the PHP and also a debugger trace.

    Thanks,
    Allan

  • scottjenkinsscottjenkins Posts: 5Questions: 1Answers: 0
    edited April 2015

    Hi Allan,

    Believe it or not I somehow missed out the complete server-side processing part.

    I was using this code:

    ajax: "/php/table.php",
    

    so I changed it to this:

            ajax: {
                url: "/php/table.php",
                type: "POST"
            },
            serverSide: true,
    

    and now it's more than less instant on page load.

    I have no idea how I managed to do that, in my head I was using server-side processing. What was happening in my case prior to making the change?

    Thanks,
    Scott

  • allanallan Posts: 61,805Questions: 1Answers: 10,119 Site admin

    No worries :-)

    Before it was using client-side processing, so all 70'000 rows were being read from the database and sent to the client at table load time.

    Editor's libraries will automatically detect a server-side processing request and switch into that mode, which is why the little change you made allowed it to work in server-side processing mode.

    Allan

  • scottjenkinsscottjenkins Posts: 5Questions: 1Answers: 0

    Hi Allan,

    Thanks.

    Appears switching to server-side processing has broken search.

    Warning: date() expects parameter 1 to be string, object given in C:\inetpub\dev\php\lib\Database\Query.php on line 556
    

    I am using an SQLite database and search did work when we were using client-side processing.

    Here is the relevant part in PHP, if it is the problem with server-side processing?

      Field::inst( 'date' )
                ->validator( 'Validate::dateFormat', array( 'format'=>'Y-m-d' ) )
                ->getFormatter( 'Format::date_sql_to_format', 'Y-m-d' )
                ->setFormatter( 'Format::date_format_to_sql', 'Y-m-d' )
        )
    

    Thanks,
    Scott

  • allanallan Posts: 61,805Questions: 1Answers: 10,119 Site admin

    Hi,

    Could you confirm which version of Editor you are using please? Line 556 in Query.php in 1.4.2 is in the middle of a comment block.

    I very strongly suspect that the library is attempting to execute your column name because it matches a PHP built in function name. If you were to call it something my 'regDate' it should work.

    However, if that is an issue in the current libraries it would be good to fix it :-)

    Allan

  • scottjenkinsscottjenkins Posts: 5Questions: 1Answers: 0

    Hi Allan,

    Line 556 is:

                $key( $this );
    

    I appear to be using an older version at the moment.

    I'll gave changing the name a shot.

    Thanks,
    Scott

  • scottjenkinsscottjenkins Posts: 5Questions: 1Answers: 0

    Hi Allan,

    Yep that sorted it.

    Thanks,
    Scott

  • allanallan Posts: 61,805Questions: 1Answers: 10,119 Site admin

    Fantastic - good to hear. Thanks for letting me know.

    Allan

This discussion has been closed.