Welcome, Guest
Username: Password: Remember me

TOPIC: Two information in a combobox

Re: Two information in a combobox 07 Dec 2012 17:34 #5902

  • jpcponce
  • jpcponce's Avatar
audibleid wrote:
Sorry to bother you again Jocelyn,

I just wondered how to handle adding additional related fields when using ajax combo and groupby? Could you please demonstrate?

Here's the jDom code for my Category field:
// Category
$field = $fieldSet['jform_category'];
$field->jdomOptions = array(
	'ajaxVars' => array('values' => array(
		$this->item->category))
);
many thanks,

Gez

I am looking for same solution.

javier
The administrator has disabled public write access.

Re: Two information in a combobox 07 Dec 2012 21:32 #5911

  • admin
  • admin's Avatar
  • Online
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
When you are using Ajax, the returned HTML is coming from the VIEW.

displayAjax() is containing the JDom calls.

Do the same there.
Coding is now a piece of cake
The administrator has disabled public write access.
The following user(s) said Thank You: JoomGuy, jpcponce

Re: Two information in a combobox 07 Dec 2012 22:13 #5915

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
Thanks kind monsier!
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.

Re: Two information in a combobox 06 May 2013 06:58 #7144

  • dieda1821
  • dieda1821's Avatar
  • Offline
  • Senior Member
  • Posts: 53
  • Thank you received: 2
  • Karma: 4
Hi all,

Sorry for bringing this up.

I followed the instructions described in this thread and everything work when customizing the labelKey with multiple data entry.
Anyhow, I can't find a way to insert a function inside labelKey.

I am trying to mimic this code (from com_category) that shows a list-combo with category names and a number of "-" that reflects the category level (a property present in the array showing the category name):
$options[$i]->text = str_repeat('- ', $options[$i]->level). $options[$i]->text ;

Now, inside jdom list, this works:
$field = $fieldSet['jform_parent_id'];
$respar=$this->lists['fk']['parent_id'];
$field->jdomOptions = array(
			'list' => $this->lists['fk']['parent_id'],
			'groupBy' => array(
					'el_ref' => 'el_ref'
				),
			'labelKey' => str_repeat('- ',2) . "{el_ref}"
		);

But I can't find a way to replace the fixed number 2 with the propery level.

This shows correctly the level value for each element:
$field = $fieldSet['jform_parent_id'];
$respar=$this->lists['fk']['parent_id'];
$field->jdomOptions = array(
			'list' => $this->lists['fk']['parent_id'],
			'groupBy' => array(
					'el_ref' => 'el_ref'
				),
			'labelKey' =>  "{level} {el_ref}"
		);

But I can't input {level} inside the str_repeat function. The following outputs the function as normal echoed text, followed by the level value:
$field = $fieldSet['jform_parent_id'];
$respar=$this->lists['fk']['parent_id'];
$field->jdomOptions = array(
			'list' => $this->lists['fk']['parent_id'],
			'groupBy' => array(
					'el_ref' => 'el_ref'
				),
			'labelKey' => "str_repeat('- ',{level})  {el_ref}"
		);

So, how can I enter a function inside my labelKey value ?

Thanks

Elena
The administrator has disabled public write access.
Time to create page: 0.093 seconds

Get Started