Silverstripe 3 - LeftAndMain::ForceReload - silverstripe

I need to reload the content area in the admincenter after deleting a dataobject.
This dataobject is managed inside an Inline-Editing-Gridfield.
That's the my code on the dataobject
public function onAfterDelete(){
parent::onAfterDelete();
if( Session::get('ShopReloadAdminPage') ){
Session::clear('ShopReloadAdminPage');
return LeftAndMain::ForceReload();
}
}
The Problem is, that this only reloads the Inline-Grid and makes it disappear.
Does someone know how to achieve this?
Thank you in advance

LeftAndMain::ForceReload() doesn't exist in SilverStripe 3+. I'd guess the reason your GridField is disappearing is because its throwing an error when you call it.

Related

Collapsing Toolbar Layout always expanded when returned from fragment

I have 2 fragments (Fragment A and Fragment B) both with collapsing toolbar layouts and corresponding recyclerviews within a coordinatorlayout.
If I scroll up in my recyclerview (so the CollapsingToolbarLayout has collapsed) and then open Fragment B from fragment A (Pushing A onto the backstack).
When I return to fragment A by hitting back. The CollapsingToolbarLayout/AppBarLayout is always expanded, even though the recycler view is in the same position.
Anyone experience this?
There's a issue related to this.
According to Chris Banes.
Add these lines inside onViewCreated() of your fragment to solve the issue.
ViewCompat.requestApplyInsets(mCoordinatorLayout);
It's an old question but none of the answers it's correct. I found this other question where they fixed the problem:
How to restore Collapsing Toolbar Layout State after screen orientation change
You have to set an id to your views in order to restore their state automatically.
I had face same problem so i write below code:-
private boolean isExpand = true;
private void setTitleNotExpand(boolean isExpand) {
if(getFragmentViewHolder() != null) {
this.isExpand = isExpand;
// AppBarLayout variable
getFragmentViewHolder().appbar.setExpanded(isExpand);
}
}
when you do add back stack then write below code :-
// write below code where you want to stick your toolbar
setTitleNotExpand(false);
// write below code where you want not to stick your toolbar
setTitleNotExpand(true);
on your onFragmentViewHolderCreated write below code :-
getFragmentViewHolder().appbar.setExpanded(isExpand);
another thing to consider is that views cannot restore their state if they don't have an id
Today, to fix this issue you only have to set an id to your coordinator layout to fix this.

iOS 9: Frame no longer set in viewWillAppear after UINavigationController pushViewController

I'm trying to solve a view placement bug that has arisen as of iOS 9. I am instantiating a view controller from a xib file (non-autolayout) and then pushing this onto my UINavigationController.
The problem is that when the view controller's viewWillAppear method is called, its frame has not yet been adjusted to the navigation controller's size and is still what was set in the xib file. It doesn't get set properly now until viewDidAppear.
This is completely screwing up my code. Does anyone know precisely what has changed that is causing this and what is the best way to handle it? I don't want to wait until viewDidAppear because this will look bad and make for a poor user experience.
I am also looking for the best fix.
My temporary one is to call the code that was in "viewDidAppear" in "viewDidLayoutSubviews". That way, my code will get called as soon as the frames are set.
But, make sure to add a boolean or something so that your code doesn't get called every time viewDidLayoutSubviews is called
-(void)viewDidLayoutSubviews{
if (didLayoutSubviews == NO){
didLayoutSubviews = YES;
// perform code that was in viewWillAppear
}
}
I occurred this issue too,
try to uncheck option "Resize View From NIB" from storyboard
Try moving the layout code from viewWillAppear to viewWillLayoutSubviews.
A little bit updated NickProvost's answer:
private var loadViewToken: dispatch_once_t = 0
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
dispatch_once(&loadViewToken) { [weak self] in
if let wSelf = self {
wSelf.setupView()
}
}
}

XAF: How to minimize ribbon from code in XAF Windows App

I want to minimize the ribbon when user click on particular navigation Item.
For example - when User clicks on Dashboard nav item, I want the ribbon minimized, and automatically "maximized" on others.
How can I do that ?
I've found that I can simple access the ribbon in the ViewController.
So like usual in XAF, override "OnActivated" and do the magic there
protected override void OnActivated()
{
if (Frame.Template != null)
{
((XtraFormTemplateBase)Frame.Template)).RibbonTransformer.Ribbon
.Minimized = View.Id == "TestView;
}
base.OnActivated();
}
I got a couple of errors while accessing Frame.Template being NULL when I'd hit a dashboardview, with many nested ListView in it. Make sure You don't forget to check it :)
They released a hotfix for this bug in Devexpress's version 22.1.4. Today I updated to 22.1.4 while getting this error when there was version 22.1.3 and the error was completely resolved.
NullReferenceException is thrown in the MinimizedRibbonPopupForm.GetSizeWithIndents method when the Classic panel style is used

Weird error when creating new Action Script class

Good Morning,
I have a very odd error working in adobe flexbuilder 3.
Ever since yesterday when ever I create a new class, Flex builder do not see anything wrong in my class.
how do i create one:
Right click on a folder in the package hierarchy
--> new
--> action script class
I leave everthing as is but i give it a name obviously
finish
The class is created.
I can now type anything into this class... Even the words "abc" and flex builder do not see that this is wrong.
if i go to an existing class and type "abs" , the moment i hit save it complains about the "abc"
I have tried the following but the problem still persists.
Deleted my workspace and created a new one and re-import.
If i right click on the class in the Flex navigator the "inlcude class in library" is greyed out.
if anyone can give me an idea, even if it is silly, please do. I really need to be able to add new classes.
thanks
The new class that i have created looks like
package za.co.dcs.cib.das.application.vo.authorisation.appDetails.memberDetails
{
public class MyNewlyTestClass
{
public function MyNewlyTestClass()
{
}
}
}
and then i add "ABC" to it... to which it don't complain about. I can add just about anything i want to this class... and nothing is ever an error.
package za.co.dcs.cib.das.application.vo.authorisation.appDetails.memberDetails
{
public class MyNewlyTestClass
{
public function MyNewlyTestClass()
{
abc
}
}
}
Or if i remove the function
package za.co.dcs.cib.das.application.vo.authorisation.appDetails.memberDetails
{
public class MyNewlyTestClass
{
public MyNewlyTestClass()
{
}
}
}
Flash Builder is plain stupid. The ide does not translate the ActionScript into an abstract syntax tree when typing, only check for the syntax when saving.
Don't know if this is default behavior but what i have found is that...
If I change an existing class the compiler checks the syntax but if I add a random file the compiler will only check the file if that file is used by my application.
I have tried this and it seems to work. The moment that you call that file from within your application it validates and give me errors where should be.
Thanks for all your updates

Drupal hook_form_alter: how to target only node/edit and NOT node/add. Aso, why #disabled doesn´t work?

I want to disable a cck field inside a specific form in Drupal 6.
I´ve created a new module full of alterations, using hook_form_alter.
The form id is articulo_node_form. The field in question is text, I´ve checked and it can be disabeled.
I´ve tried this:
function modding_form_articulo_node_form_alter(&$form, &$form_state, $form_id) {
$form['field_articulo_tipo']['#disabled'] = 1;
}
The field doesn´t disable at all, instead, it dissappears.
Anyway that happens when I try to create a new articulo node or when I try to edit that node. I want to target only node edits, I mean, the same form, but when it´s being edited.
What´s wrong with that code?
THANKS FOR YOUR HELP!!
Rosamunda
I can't think of a reason why the code you've got wouldn't work but you can use code like this to 'force' the attribute to be displayed:
$form['field_articulo_tipo']['#attributes']['disabled'] = 'disabled';

Resources