Skip to main content
replaced http://tridion.stackexchange.com/ with https://tridion.stackexchange.com/
Source Link

The methods _isEnable or _isAvailable are not good places to start loading an item asynchronously it is the same for every method that will return a result because in an asynchronous execution model we cannot have a sequential execution.

SOLUTION:

_isAvailable and _isEnable are always called after you change a selection in the CMS, for instance when you select a new item in a List or in a Tree the CME will call toolbar.updateState(selection). This method will call _isAvailable and _isEnable for all the commands available including yours.

OK, how you can execute some custom logic when you select a new item in a List or in a Tree, well there are few options there, you can use a domain level javascript or my preferred way you can extend a resources group and bind a change event to the current list object or tree control, in that custom change event handler that should be executed at the end you can load your current selected item and then call toolbar.updateState(selection) once your item is already loaded, it will call your _isEnable and _isAvailable methods but your item will be already loaded so you will get access to all the information.

If you are looking for a sample about how to extend a resources group, check it out Extend a resources groupExtend a resources group

I hope this helps.

UPDATE

I have written a post about this issue with an implementation of this answer. Full Load an Item before _isAvailable and _isEnabled are executed

The methods _isEnable or _isAvailable are not good places to start loading an item asynchronously it is the same for every method that will return a result because in an asynchronous execution model we cannot have a sequential execution.

SOLUTION:

_isAvailable and _isEnable are always called after you change a selection in the CMS, for instance when you select a new item in a List or in a Tree the CME will call toolbar.updateState(selection). This method will call _isAvailable and _isEnable for all the commands available including yours.

OK, how you can execute some custom logic when you select a new item in a List or in a Tree, well there are few options there, you can use a domain level javascript or my preferred way you can extend a resources group and bind a change event to the current list object or tree control, in that custom change event handler that should be executed at the end you can load your current selected item and then call toolbar.updateState(selection) once your item is already loaded, it will call your _isEnable and _isAvailable methods but your item will be already loaded so you will get access to all the information.

If you are looking for a sample about how to extend a resources group, check it out Extend a resources group

I hope this helps.

UPDATE

I have written a post about this issue with an implementation of this answer. Full Load an Item before _isAvailable and _isEnabled are executed

The methods _isEnable or _isAvailable are not good places to start loading an item asynchronously it is the same for every method that will return a result because in an asynchronous execution model we cannot have a sequential execution.

SOLUTION:

_isAvailable and _isEnable are always called after you change a selection in the CMS, for instance when you select a new item in a List or in a Tree the CME will call toolbar.updateState(selection). This method will call _isAvailable and _isEnable for all the commands available including yours.

OK, how you can execute some custom logic when you select a new item in a List or in a Tree, well there are few options there, you can use a domain level javascript or my preferred way you can extend a resources group and bind a change event to the current list object or tree control, in that custom change event handler that should be executed at the end you can load your current selected item and then call toolbar.updateState(selection) once your item is already loaded, it will call your _isEnable and _isAvailable methods but your item will be already loaded so you will get access to all the information.

If you are looking for a sample about how to extend a resources group, check it out Extend a resources group

I hope this helps.

UPDATE

I have written a post about this issue with an implementation of this answer. Full Load an Item before _isAvailable and _isEnabled are executed

added 254 characters in body
Source Link
Eric Huiza
  • 9.4k
  • 15
  • 28

The methods _isEnable or _isAvailable are not good places to start loading an item asynchronously it is the same for every method that will return a result because in an asynchronous execution model we cannot have a sequential execution.

SOLUTION:

_isAvailable and _isEnable are always called after you change a selection in the CMS, for instance when you select a new item in a List or in a Tree the CME will call toolbar.updateState(selection). This method will call _isAvailable and _isEnable for all the commands available including yours.

OK, how you can execute some custom logic when you select a new item in a List or in a Tree, well there are few options there, you can use a domain level javascript or my preferred way you can extend a resources group and bind a change event to the current list object or tree control, in that custom change event handler that should be executed at the end you can load your current selected item and then call toolbar.updateState(selection) once your item is already loaded, it will call your _isEnable and _isAvailable methods but your item will be already loaded so you will get access to all the information.

If you are looking for a sample about how to extend a resources group, check it out Extend a resources group

I hope this helps.

UPDATE

I have written a post about this issue with an implementation of this answer. Full Load an Item before _isAvailable and _isEnabled are executed

The methods _isEnable or _isAvailable are not good places to start loading an item asynchronously it is the same for every method that will return a result because in an asynchronous execution model we cannot have a sequential execution.

SOLUTION:

_isAvailable and _isEnable are always called after you change a selection in the CMS, for instance when you select a new item in a List or in a Tree the CME will call toolbar.updateState(selection). This method will call _isAvailable and _isEnable for all the commands available including yours.

OK, how you can execute some custom logic when you select a new item in a List or in a Tree, well there are few options there, you can use a domain level javascript or my preferred way you can extend a resources group and bind a change event to the current list object or tree control, in that custom change event handler that should be executed at the end you can load your current selected item and then call toolbar.updateState(selection) once your item is already loaded, it will call your _isEnable and _isAvailable methods but your item will be already loaded so you will get access to all the information.

If you are looking for a sample about how to extend a resources group, check it out Extend a resources group

I hope this helps.

The methods _isEnable or _isAvailable are not good places to start loading an item asynchronously it is the same for every method that will return a result because in an asynchronous execution model we cannot have a sequential execution.

SOLUTION:

_isAvailable and _isEnable are always called after you change a selection in the CMS, for instance when you select a new item in a List or in a Tree the CME will call toolbar.updateState(selection). This method will call _isAvailable and _isEnable for all the commands available including yours.

OK, how you can execute some custom logic when you select a new item in a List or in a Tree, well there are few options there, you can use a domain level javascript or my preferred way you can extend a resources group and bind a change event to the current list object or tree control, in that custom change event handler that should be executed at the end you can load your current selected item and then call toolbar.updateState(selection) once your item is already loaded, it will call your _isEnable and _isAvailable methods but your item will be already loaded so you will get access to all the information.

If you are looking for a sample about how to extend a resources group, check it out Extend a resources group

I hope this helps.

UPDATE

I have written a post about this issue with an implementation of this answer. Full Load an Item before _isAvailable and _isEnabled are executed

Source Link
Eric Huiza
  • 9.4k
  • 15
  • 28

The methods _isEnable or _isAvailable are not good places to start loading an item asynchronously it is the same for every method that will return a result because in an asynchronous execution model we cannot have a sequential execution.

SOLUTION:

_isAvailable and _isEnable are always called after you change a selection in the CMS, for instance when you select a new item in a List or in a Tree the CME will call toolbar.updateState(selection). This method will call _isAvailable and _isEnable for all the commands available including yours.

OK, how you can execute some custom logic when you select a new item in a List or in a Tree, well there are few options there, you can use a domain level javascript or my preferred way you can extend a resources group and bind a change event to the current list object or tree control, in that custom change event handler that should be executed at the end you can load your current selected item and then call toolbar.updateState(selection) once your item is already loaded, it will call your _isEnable and _isAvailable methods but your item will be already loaded so you will get access to all the information.

If you are looking for a sample about how to extend a resources group, check it out Extend a resources group

I hope this helps.