Thanks that's easier I guess

Jacques

Le 03/11/2024 à 16:25, Omar Abdullwahhab a écrit :
Hi Jacques,
I have made a simple plugin
Which shows cascading select , using Geo Entity
Another one is for auto trigger which gets the sayDate service
Every 3 seconds.
Here is the link for the plugin repo.

https://github.com/OmarAbdullwahhab/ofbiz-htmx

I will add more example also with one fantastic thing
Which is called ( web components) that will be a very nice
And seamlessly fits the OFBiz way.
https://youtu.be/-USODEI-kgg


On Sun, Nov 3, 2024 at 11:19 AM Jacques Le Roux <
jacques.le.r...@les7arts.com> wrote:

Thanks Omar,

I'll have a look again...

Jacques

Le 01/11/2024 à 20:35, Omar Abdullwahhab a écrit :
Hi Jacques,
You are most welcome.
For the complex examples , I will prepare it through this week.
For the error you got it's really not clear,
But I think its may be related to @ symbole,
Try download htmx file instead of using the unpkg site.
And  include it with the theme js files as normal.

Regards


On Fri, Nov 1, 2024 at 1:39 PM Jacques Le Roux <
jacques.le.r...@les7arts.com>
wrote:

Thanks Omar,

Got this error in js console:

      TypeError: Not enough arguments to XPathEvaluator.createExpression.
           htmx< https://unpkg.com/htmx.org@2.0.3:1:23876
           <anonyme> https://unpkg.com/htmx.org@2.0.3:1:10

No ideas what's wrong. I used product as component. I put my patch at
http://les7arts.com/htmx.patch

BTW, someone know what has replaced https://paste.apache.org ?

TIA

Jacques

Le 31/10/2024 à 15:25, Omar Abdullwahhab a écrit :
Sorry
8. the java service
public class HtmxServices {

       public static Map<String,Object> sayDate(DispatchContext
dispatchContext, Map<String,Object> context){
           var result = ServiceUtil.returnSuccess();
           result.put("currentDate", LocalDateTime.now().toString());
           return result;

       }
}


On Thu, Oct 31, 2024 at 5:07 PM Omar Abdullwahhab <
omar.abdullwah...@gmail.com> wrote:

OK
For you not to waste your time,
Just a quick example
I have made
1. first insert the following htmx link in the Header.ftl in the theme
you
are using
<script src="https://unpkg.com/htmx.org@2.0.3";></script>
2. Controller.xml

<!-- Request Mappings -->
<request-map uri="main">
       <security https="true" auth="true"/>
       <response name="success" type="view" value="main"/>
</request-map>

<request-map uri="sayDate">
       <security https="true" auth="true"/>
       <event type="service" invoke="sayDate"/>
       <response name="success" type="view" value="sayDate"></response>
</request-map>
<!-- View Mappings -->
<view-map name="main" type="screen"
page="component://ofbizFreemarker/widget/OfbizFreemarkerScreens.xml#main"/>
<view-map name="sayDate" type="ftl"
page="component://ofbizFreemarker/templates/say_date.ftl"/>
3. services.xml

<service name="noSyntaxError" engine="interface">
       <description>
           Dummy service to prevent empty files and syntax error -
Remove
when the 1st real service will be added here
       </description>
</service>

<service name="sayDate" engine="java"
            location="org.apache.ofbiz.ofbizfreemarker.HtmxServices"
            invoke="sayDate">
       <attribute name="currentDate" type="String" mode="OUT"
default-value=""/>
</service>

4. XXXScreens.xml

<screen name="main">
       <section>
           <actions>
               <set field="headerItem" value="main"/><!-- this
highlights
the selected menu-item with name "main" -->
           </actions>
           <widgets>
               <decorator-screen name="OfbizFreemarkerCommonDecorator"
location="${parameters.mainDecoratorLocation}">
                   <decorator-section name="body">
                       <platform-specific>
                           <html><html-template
location="component://ofbizFreemarker/templates/Main.ftl"/></html>
                       </platform-specific>

                   </decorator-section>
               </decorator-screen>
           </widgets>
       </section>
</screen>

5. Main.ftl

<button hx-get="<@ofbizUrl>sayDate</@ofbizUrl>"
hx-target="#responseDiv" hx-swap="outerHTML">
      Say Date
    </button>

    <div id="responseDiv">

    </div>

6. say_date.ftl

<div id="responseDiv">
<h4>${requestAttributes.currentDate}</h4>
</div>

7. That's all.




On Thu, Oct 31, 2024 at 4:42 PM Jacques Le Roux <
jacques.le.r...@les7arts.com> wrote:

Great,

That sound to confirm again
https://lists.apache.org/thread/pxoq4484jws79jvw3ct501nt3t26hlyw

We really need to seriously investigate now...

Jacques

Le 31/10/2024 à 14:25, Omar Abdullwahhab a écrit :
Hi All.

Today I was playing around the client side in OFBIZ,
I'm actually not a fan of JS or its frameworks.
I tried making a test to replace it with htmx.
It was very good and easy to integrate with OFBiz and Freemarker.
Please have a look
https://htmx.org/docs/
I am sure it will be a proven technology for OFBiz.
Regards
--
Omar Abu-Arab
Java Engineer




Reply via email to