Jump to content


Replace url filename with custom text


  • Please log in to reply
3 replies to this topic

#1 navajo

navajo

    Member

  • Members
  • PipPip
  • 12 posts

Posted 19 January 2019 - 09:12 PM

Hi there..

 

 

Can't seem to get my head around this issue...

 

I want to replace the file url listed in a row with an alternate text such as "View File".

 

img.jpg

 

 

Any suggestions?



#2 NadimD

NadimD

    Member

  • Members
  • PipPip
  • 13 posts

Posted 21 January 2019 - 12:28 AM

Greetings !

 

You can use a callback on the column to achieve that :

 

https://www.groceryc...callback_column

 

Let me know if this works for you.



#3 navajo

navajo

    Member

  • Members
  • PipPip
  • 12 posts

Posted 25 January 2019 - 01:53 PM

Hi NadimD

 

Thank you, that is what I was trying to use, but had an error in my syntax, but sorted it out. Now just to figure out how to activate a callback when the  link is clicked.

 

Thanks for taking the effort to reply.



#4 NadimD

NadimD

    Member

  • Members
  • PipPip
  • 13 posts

Posted 30 January 2019 - 01:41 PM

You're welcome !

 

Well, to make a callback on the clicked link, that would be out of Grocery Crud since the click is handle by the browser.

That means you could either add a onclick='yourcallback();' on your link, and make a JS function yourcallback() , or you can init a click event with jQuery, outside GroceryCRUD.

 

Make sure you load jQuery or any library you use to handle the clicks if you use a library, and that's it !

If the callback is supposed to happen after the link is clicked, on the target, that would be server-side !

 

Let me know if you understand and feel free to provide me more details.

 

I personnally don't want to get into the GCRUD React scripts, they can be updated any time and I'm not a React developer, so I handle everything else in my own script.js using jQuery.

 

That's how I made a "preview" button for instance, I have a table "articles" with a text field, and I added a preview button near the Save button to achieve custom events.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users