Hello,
Is there anyway to add new action while it run javascript function?
⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠
Posted 20 February 2014 - 11:58 AM
Hello,
Is there anyway to add new action while it run javascript function?
Posted 21 February 2014 - 05:37 AM
Greetings Hamed,
well technically there aint any way you can currently add an action and assign a javascript function to the same. If you want to achieve it, there are 2 options to the same
1 - alter the GC base library and change a certain piece of codes. The function which generates the action link .. what it dose is attach base url to the same ... now instead, you give it an additional option in the function to accept a function and whether to assign the base url or not (u can refer the same to set_js() function. Default value should be true for this parameter so if nothing is passed - it wont give any error. Next check if true - add base_url - if not - just letgo with the same value of call as provided by the user.
This is 1 crude way of doing thing ...There is another way of achieving he same is through javascript. Each action you have created is assigned with a title to the same. You can use this title to hook the link to the same. You can create a new JS file and add some code like this and attach to your output using set_js
window.onload=function(){ $("a[title='All Comments']").click(function(e) { //// here u should place any title of the button you want to hook to e.preventDefault(); //This is a must - it will bock any action provided by u on click of the button alert("I was clicked"); ///Here is where u add whatever action you want to assign to. }); }
Happy GCing:)
Posted 02 May 2014 - 02:48 AM
Hello,
Can you give me an eample?