Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Double page reading afterg the class change

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 1260 Views
  • xmedeko
    Avatar
    Community Member
    94 Posts

    Double page reading afterg the class change Link to this post

    Hi,

    when I change the class in the Behaviour tab and save the page, then there's twice:

    FormResponse::add("$('Form_EditForm').getPageFromServer($record->ID);");
    FormResponse::add("$('Form_EditForm').getPageFromServer($record->ID);");

    in the response. So the page is read twice from the server. I have comented the first one in the LeftAndMain.php:

    // Update the icon if the class has changed
    if($originalClass != $record->ClassName) {
    $record->setClassName( $record->ClassName );
    $newClass = $record->ClassName;
    $record = $record->newClassInstance( $newClass );

    FormResponse::add("if(\$('sitetree').setNodeIcon) \$('sitetree').setNodeIcon($record->ID, '$originalClass', '$record->ClassName');");
    // fixed double reading //FormResponse::add("$('Form_EditForm').getPageFromServer($record->ID);");
    }

    // HACK: This should be turned into somethign more general
    if( ($record->class == 'VirtualPage' && $originalURLSegment != $record->URLSegment) ||
    ($originalClass != $record->ClassName) || self::$ForceReload == true) {
    FormResponse::add("$('Form_EditForm').getPageFromServer($record->ID);");
    }

  • Andy
    Avatar
    230 Posts

    Re: Double page reading afterg the class change Link to this post

    Good spotting, thanks!

    1260 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.