Welcome, Guest
Username: Password: Remember me

TOPIC: How (or why) to use Task Property "Reuse"?

How (or why) to use Task Property "Reuse"? 30 Nov 2012 14:14 #5695

  • gdpodesta
  • gdpodesta's Avatar
  • Offline
  • Senior Member
  • Posts: 75
  • Thank you received: 8
  • Karma: -42
I've been trying to tie some views together, and keep running into this property on the toolbar Tasks. It confuses me because I don't seem to be able to add my own Tasks to the toolbar (e.g. "Print" item) to make use of it.

Could you give a simple example as it applies to a core Joomla component (e.g. Categories or Articles) showing how it would be used? The popup help says "Reuse the ID value of the item in another request var. ex: filter_category=[ID]", but I don't understand why someone would use it on one of the pre-defined tasks on the toolbar (why would I "edit" anything other than the selected item, so what does "filter_category" accomplish by adding it to the task property?)
Last Edit: 30 Nov 2012 14:14 by gdpodesta.
The administrator has disabled public write access.

Re: How (or why) to use Task Property "Reuse"? 02 Dec 2012 11:41 #5717

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
TODO in your controller
case 'myLayout.myTask':
	
	// Always better to use the states var because $item can be blank at this point (if new item)
	// TODO in model : After saving, init a new state var (the name you want ie : '[ITEMNAME].catid')
	$myCatid = $model->getState('[ITEMNAME].catid');
				
				
	$this->applyRedirection($result, array(
//On failure : $result = 0
		'com_xxxxx.myCurrentView.myCurrentLayout',
//On success : $result = 1
		'com_content',
//Facultative : What you want if $result = 2
		'.....'
	), array(
		'cid[]' => null,
		'filter_category_id' => $myCatid
	));
	break;

Hope it helps.
Not tested.
Coding is now a piece of cake
The administrator has disabled public write access.
The following user(s) said Thank You: gdpodesta
Time to create page: 0.058 seconds

Get Started