Search code examples
moqui

search-form-inputs tag not working properly with econditions


i'm doing an entity-find with econditions and I put the result list in a form-list element on my page. I want the ability of sorting on columns so i've put a <search-form-inputs/> tag at the end of my entity-find. the problem is that the entity-find doesn't work properly for the econditions I've included (Its results are not what they are supposed to be!)

and when I remove the <search-form-inputs/> tag everything just works fine. any suggestions? maybe I'm not using this tag in the right way.

                   <entity-find entity-name="me.myJointView" list="itmTemp" distinct="true">
                    <econdition field-name="myId" operator="less-equals" from="rNTo" ignore-if-empty="true"/>
                    <econdition field-name="myId" operator="greater-equals" from="rNFrom" ignore-if-empty="true"/>
                    <econdition field-name="myName" from="fName" ignore-if-empty="true"/>
                    <econdition field-name="mySurname" from="lName" ignore-if-empty="true"/>
                    <econdition field-name="myDate" operator="less-equals" from="aDTo" ignore-if-empty="true"/>
                    <econdition field-name="someId" operator="equals" from="so" ignore-if-empty="true"/>
                    <econdition field-name="someOtherId" operator="equals" from="rm" ignore-if-empty="true"/>
                    <econditions combine="or">
                        <econdition field-name="myStateEnumId" operator="equals" value="something"/>
                        <econdition field-name="myStateEnumId" operator="equals" value="somethingElse"/>
                    </econditions>
                    <econditions combine="or">
                        <econditions combine="and">
                            <econdition field-name="aDate" from="null"/>
                            <econdition field-name="myDate" operator="greater-equals" to-field-name="aDate"/>
                        </econditions>
                        <econditions combine="and">
                            <econdition field-name="myDate" operator="less-equals" to-field-name="dDate"/>
                            <econdition field-name="myDate" operator="greater-equals" to-field-name="aDate"/>
                        </econditions>
                    </econditions>
                    <search-form-inputs/>
                    <select-field field-name="myId"/>
                    <select-field field-name="myName"/>
                    <select-field field-name="mySurname"/>
                    <select-field field-name="MyDate"/>
                    <order-by field-name="myDate,RECETEST.lastUpdatedStamp"/>
                </entity-find>

Solution

  • I had a form-list in my screen that its column names was identical to the fields I set econditions on. something like:

    <form-list  name="list" list="receptions"  headre-dialog="true" paginate="true"> 
    

                        <field name="mySurname" skip-form="false">
                            <header-field show-order-by="true"><text-find hide-options="true"/></header-field>
                            <default-field><display/></default-field>
                        </field>
                        <field name="myDate" skip-form="false">
                            <header-field show-order-by="true"><text-find hide-options="true"/></header-field>
                            <default-field><display/></default-field>
                        </field>
                        <field name="editButton">
                            <default-field>
                                <link url="edit" parameter-map="[myId:myId]" icon="glyphicon glyphicon-pencil" btn-type="info" />
                            </default-field>
                        </field>
                        <form-list-column>
                            <field-ref name="myId" skip-form="true"/>
                        </form-list-column>
                        <form-list-column>
                            <field-ref name="myName"/>
                        </form-list-column>
                        <form-list-column>
                            <field-ref name="mySurname"/>
                        </form-list-column>
                        <form-list-column>
                            <field-ref name="myDate"/>
                        </form-list-column>
                        <form-list-column>
                            <field-ref name="editButton"/>
                        </form-list-column>
                        <field-layout>
                            <fields-not-referenced/>
                            <field-row>
                                <field-ref name="myId"/>
                                <field-ref name="myName"/>
                                <field-ref name="mySurname"/>
                                <field-ref name="myDate"/>
                                <field-ref name="editButton"/>
                            </field-row>
                        </field-layout>
                    </form-list>
    

    I added the line below and removed orderBy statement at the end of my entity-find:

     <search-form-inputs input-fields-map="[orderByField:ec.web.parameters.orderByField]" default-order-by="myDate,myId,mySurname,myName,myDate" />
    

    and checked from the query stats screen that the query produced by the two entity-finds in this topic are the same (apart from the orderBy statement added in the new query) except that:

    1- the entity-find in this post add a "limit 20 offset 0" at the end of the query (which i can handle by setting a high limit)

    2- I can't orderBy RECETEST.lastUpdatedStamp (which I used at the entity-find definition in the main question) anymore. AND I NEED THIS FUNCTIONALITY! WHAT SHOULD I DO?