ofbiz code in java script

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

ofbiz code in java script

Antony Adopo
Hello, Ofbizers.

please, could we use Ofbiz list in javascript code.
I need this for a personnal paging script.

exemple "productCategoryMembers" list

Please give me an example on how implement it.

thanks
Reply | Threaded
Open this post in threaded view
|

Re: ofbiz code in java script

Antony Adopo
and also code like ${productsummaryScreen} in javascript code?


2013/10/20 Antony Adopo <[hidden email]>

> Hello, Ofbizers.
>
> please, could we use Ofbiz list in javascript code.
> I need this for a personnal paging script.
>
> exemple "productCategoryMembers" list
>
> Please give me an example on how implement it.
>
> thanks
>
>
Reply | Threaded
Open this post in threaded view
|

Re: ofbiz code in java script

Paul Piper
Hi,

unfortunately, Javascript is client-side whereas the variables you mention are processed serverside. If you want to put anything in the context of javascript (so that you can use it in a function or such), you will have to add it in the templates as such:

<script> var myList = ${request.myList!}; </script>
this is of course pseudo code, but by rendering it out during page load, the variable you define in the body of the html, will be available for the javascript you define. Whenever you do, however, make sure to wrap your javascript in a


$(document ).ready(function() {
// my code

});


function. That way your static javascript file will be processed after the page has been succesfully loaded...