Welcome, Guest
Username: Password: Remember me

TOPIC: [SOLVED] Best practice linking one grid view to another?

Best practice linking one grid view to another? 07 Jan 2014 11:38 #11937

  • dyvel
  • dyvel's Avatar
  • Offline
  • Elite Member
  • Posts: 200
  • Thank you received: 11
  • Karma: 10
Hi

Currently I'm linking one grid view to another with a filter to show only results that relates to the first grid item like this:
<td style="text-align:center">
  <a href="index.php?option=com_myComponent&view=myView&layout=default&filter_myFilter=<?php echo $row->id; ?>">Link</a>
</td>

But I was thinking if there was a better method to doing this? - it seems a little "hackish" to do it like that...
The administrator has disabled public write access.

Best practice linking one grid view to another? 08 Jan 2014 09:53 #11940

  • dyvel
  • dyvel's Avatar
  • Offline
  • Elite Member
  • Posts: 200
  • Thank you received: 11
  • Karma: 10
I can do this:
<?php echo JDom::_('html.fly', array(
	'dataKey' => 'name',
	'dataObject' => $row,
	'route' => array('view' => 'myView', 'layout' => 'myLayout', 'filter_myFilter' => $row->id)
));?>

But I'm having problems controlling the link text that way... any ideas?
Last Edit: 08 Jan 2014 09:54 by dyvel.
The administrator has disabled public write access.

Best practice linking one grid view to another? 08 Jan 2014 13:22 #11941

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
It is working for me.

Maybe you get confused because of the permanent vars.
When you send this filter trough URL, the values stays as permanent.

This is a problem I see now. It shouldn't. Only filters posted trough POST should apply permanent var.
According to the REST standards (but also better in any case) :
GET : only reading
POST : applying changes

So, there is a Cook issue here, I move in new tickets.
If you confirm your issue is related to that, I will change title of the post.


In your case, for debbuging :
If everything is ok without JDom (manual link), so it means you experience difficulties only with JDom.

The example you give is correct. What is the returned url.
What happen if you copy paste the link ?
Stange, but easy to sort it out.

The source code building the link are in :
dom.php : getRoute()
html.php : createRoute()
html/link.php : buildLink()
(Stack list)

Hope it helps you.
Coding is now a piece of cake
The administrator has disabled public write access.

Best practice linking one grid view to another? 08 Jan 2014 14:20 #11944

  • dyvel
  • dyvel's Avatar
  • Offline
  • Elite Member
  • Posts: 200
  • Thank you received: 11
  • Karma: 10
Hi

The example I posted with JDom is working correct as such - my only "issue" is controlling the generated link text ( the text <a href="">LINK TEXT</a> ) on the grid view. I'm looking to manipulate it and put whatever I want as a label, text or image and not related to the db table. Is it possible to use the "label override" that we can set under Pages in Builder?

Another unrelated wish was being able to add labels when building pages - it's not database related, but e.g. to group elements, or just info text. I can do it manually later, but would be really nice if such field element existed
The administrator has disabled public write access.

Best practice linking one grid view to another? 08 Jan 2014 20:24 #11945

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
:blush: I should write the JDom documentation
'route' => array('view' => 'myView', 'layout' => 'myLayout', 'filter_myFilter' => $row->id)

This is working for almost all JDom classes.
So just first instance your display you want, and then furnish 'route' parameter.

You whole control will be automatically embeded in a <a> markup, wich is simple and efficient, for not fit for all cases when the control is more complex (anyway...)
You dot not need to send the dataObject + dataKey. You can furnsih, even static 'dataValue'
When you use links, you can add titles and other stuff. 'title' property.

As soon as possible more infos about JDom.
Coding is now a piece of cake
Last Edit: 08 Jan 2014 20:25 by admin.
The administrator has disabled public write access.
The following user(s) said Thank You: dyvel

Best practice linking one grid view to another? 09 Jan 2014 00:22 #11946

  • dyvel
  • dyvel's Avatar
  • Offline
  • Elite Member
  • Posts: 200
  • Thank you received: 11
  • Karma: 10
Thank you very much!
The administrator has disabled public write access.
Time to create page: 0.057 seconds

Get Started