Onclick attribute in link-entry?

classic Classic list List threaded Threaded
2 messages Options
filkaris filkaris
Reply | Threaded
Open this post in threaded view
|

Onclick attribute in link-entry?

I want to populate a big grid with entries.
I just want to pass the id of the entry, and have the description show up.
I also want to execute JS when the user clicks on it.

One way, would be to use menupopup with sel_options and onclick, which works.
However, the sel_options array is HUGE, and this results in extremely big loading times.

Another way, is to use readonly link-entry with only_app specified.
This way there's no problem with loading times, the descriptions get loaded quickly.
However, I cannot override what happens when the user clicks (open the specific entry), and execute my JS

Is there a way to override this? Maybe use another <link> widget? The documentation of etemplate I have available is quite old and I cannot find anything there.

Thanks in advance!
Nathan Gray Nathan Gray
Reply | Threaded
Open this post in threaded view
|

Re: Onclick attribute in link-entry?



On 20 March 2017 at 07:14, filkaris <[hidden email]> wrote:
I want to populate a big grid with entries.
I just want to pass the id of the entry, and have the description show up.
I also want to execute JS when the user clicks on it.

One way, would be to use menupopup with sel_options and onclick, which
works.
However, the sel_options array is HUGE, and this results in extremely big
loading times.

Another way, is to use readonly link-entry with only_app specified.
This way there's no problem with loading times, the descriptions get loaded
quickly.
However, I cannot override what happens when the user clicks (open the
specific entry), and execute my JS

Is there a way to override this? Maybe use another <link> widget? The
documentation of etemplate I have available is quite old and I cannot find
anything there.


There is no way to override, that is what the widget does. 
The easiest and fastest (both for development and execution) way to achieve what you want is to actually load the data you want to display, pass it to the etemplate and use a label.
However, you may be under limitations that prevent you from using the easy way.  Other ways include fetching via AJAX or creating your own widget (extend Transformer) that takes your ID, and displays the fields you want.

You mentioned a "big grid".  Note that anywhere more than 50 rows and you should be considering switching to a nextmatch widget instead of a grid.

Nathan

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
eGroupWare-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/egroupware-developers