Show file in another table

Got something cool to share with AppGini users? Feel free to post it here!
Post Reply
kerelov
Veteran Member
Posts: 42
Joined: 2020-04-17 21:20
Location: Bulgaria

Show file in another table

Post by kerelov » 2020-04-23 10:03

So I have an app where all the documents are uploaded in one specific table called 'documents'. Later these documents could be attached to other tables related to different topics and it is possible for one document be attached to different topics. This is good to avoid uploading one document several times. But the problem is that you cant view the file in the table that it is attached to especially when there is intermediate table to solve the multi-to-multi problem. To solve this I'm attaching a link to the document in a calculated field:

Code: Select all

SELECT concat('<a href="link.php?t=documents&f=document&i=', `cases_documents`.`document`, '" target="_blank" class= "proceedings_doc btn btn-default" ><i class="glyphicon glyphicon-file text-info"></i></a>') FROM `proceedings`, `cases_documents` WHERE `proceedings`.`id`='%ID%' AND `cases_documents`.`id` = `proceedings`.`protocol`
This link extracts the document from the 'documents' table (t=documents), 'documents' field (f=document) with id (&i=).
The only problem here is that in TV there is already a link in all fields to DV. So it becomes <a><a></a></a>. To solve this I remove the parent link with unwrap() in the magic proceedings-tv.js file in hooks folder.

Code: Select all

jQuery(function(){
	jQuery(".proceedings_doc").unwrap();
});
Works pretty well but I was wondering if there is some way to solve this trough the DataList object?

Post Reply