Welcome, Guest
Username: Password: Remember me

TOPIC:

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

  • jpcponce
  • jpcponce's Avatar
  • Visitor
  • Visitor

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

Please Log in or Create an account to join the conversation.

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

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
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 following user(s) said Thank You: JoomGuy, jpcponce

Please Log in or Create an account to join the conversation.

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

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

Please Log in or Create an account to join the conversation.

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

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

Please Log in or Create an account to join the conversation.

Time to create page: 0.203 seconds
  I still don't believe he can really be human to do all this ! From all of the forums that I've ever participated in this is certainly the one that most encapsulates the feeling of being truly open source where everyone's opinions and contributions can and will shape the development of the service! It's truly awesome! Hope you enjoy cooking and look forward to reading and contributing to any of the editorial work that you proposed too!! Thanks
Gez (audibleid - JED)

Get Started