17488 Posts in 4473 Topics by 1978 members
| Go to End | Next > | |
| Author | Topic: | 5248 Views |
-
Linking to page from ComplexTableField - possible?

24 March 2008 at 8:37pm Last edited: 25 March 2008 10:51am
Hey there, I'm sure this is positive, but your tutorials nor the docs seem to have any explanation that jumps out at me.
Setting the scene:
I have a page object 'publisher' and a page object 'book'In the CMS, I have a ComplexTableField in one of the 'publishers' tabs that shows all the books.
Now my problem.
I don't mind having a popup form for adding a new book or viewing/editing certain information, but what I would LOVE is a link in the list, that will redirect to the books page, so that I can view/edit more complex stuff like its one-many relationship with genres.
I would assume the link is something like admin/show/$ID.
I tried something like
$tablefield->setFieldFormatting(array(
'Edit' => '<a href=\"/admin/show/$ID">Go to</a>'
));But it didnt work.
Any help is much appreciated.
Also - I know that I could organise the page objects in a hierarchy in the treeview, but there are going to be LOADS of books per publisher, and I would like to be able to use the complexfieldlist to sort/pageinate them per publisher.
-
Re: Linking to page from ComplexTableField - possible?

24 March 2008 at 8:43pm Last edited: 25 March 2008 10:51am
Actually, sorry, it did work, but what I meant was it loads a whole new CMS in the popup lightbox thing.
Please help me just do a straight navigation link
-
Re: Linking to page from ComplexTableField - possible?

24 March 2008 at 11:22pm Last edited: 25 March 2008 10:52am
Actually, I don't mind using the Iframe popup, but only if its possible to have tabs/ComplexTableFields within those, which I have been unable to get working and thought using pages instead of objects would help (so long as I could link from the CMS table list)
-
Re: Linking to page from ComplexTableField - possible?

30 March 2008 at 11:54pm
Have asked Ingo to take a look at this when he has a chance
-
Re: Linking to page from ComplexTableField - possible?

31 March 2008 at 9:04am
adding a target should do the trick:
$tablefield->setFieldFormatting(array(
'Edit' => '<a href=\"/admin/show/$ID\" target=\"_top\">Go to</a>'
)); -
Re: Linking to page from ComplexTableField - possible?

31 March 2008 at 6:08pm
Ta Ingo - will try tonight.
-
Re: Linking to page from ComplexTableField - possible?

1 April 2008 at 7:05pm Last edited: 1 April 2008 7:07pm
Hey guys, a target doesnt do anything, it still runs the javascript to load a lightbox window - it seems there is javascript around the table row that will load the row in the lightbox - (on closeing the lightbox it goes to the right page) please help
-
Re: Linking to page from ComplexTableField - possible?

1 April 2008 at 8:37pm Last edited: 1 April 2008 8:38pm
ah right, there's an onclick handler which takes precedence, which makes things a lot more complicated for you - try this:
$tablefield->setFieldFormatting(array(
'Edit' => '<a href=\"/admin/show/$ID\" onclick=\"javascript:function(e){top.location=this.href; return false;}\">Go to</a>'
));
its kinda bad coding style in terms of "unobtrusive javascript", but serves your purpose here.if that doesn't pan out, you could use Requirements::block("sapphire/javascript/ComplexTableField.js") and Requirements::block("sapphire/javascript/TableListField.js") in the popup call. in this case you'd lose all javascript related functionality of the table, not sure which impact this has in your specific case.
| 5248 Views | ||
| Go to Top | Next > |



