Hello, I want just sharing a small improvement realized yesterday.

During a travel, I was bored on the train I tried to replace the old ftl FindGeneric screen to display and search all entity by an xml form with auto-attribute-entity.

The main problem came from it's impossible to create a xml file with use dynamiclay an entityName for the element <auto-fields-entity> (for cache/performance reason) so I tried to generate on the fly by groovy the xml flow, and call without cache the rendering, like this :
*****
String dynamicAutoEntityFieldForm = '<?xml version="1.0" encoding="UTF-8"?><forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns="http://ofbiz.apache.org/Widget-Form"; xsi:schemaLocation="http://ofbiz.apache.org/Widget-Form http://ofbiz.apache.org/dtds/widget-form.xsd";>'
        '<form name="FindGeneric" type="single" target="FindGeneric">' +
'<auto-fields-entity entity-name="' + entityName + '" default-field-type="find"/>' +
        '<field name="noConditionFind"><hidden value="Y"/></field>' +
'<field name="entityName"><hidden value="' + entityName + '"/></field>' + '<field name="searchButton" title="' + UtilProperties.getMessage("CommonUiLabels", "FormFieldTitle_searchButton", locale) + '"><submit/></field>' +
        '</form></forms>'
Document dynamicAutoEntityFieldFormXml = UtilXml.readXmlDocument(dynamicAutoEntityFieldForm, true, true)
    [...]
    dynamicAutoEntitySearchFormRenderer.render(writer, context)
****
and on the ftl
****
${dynamicAutoEntitySearchForm?string}
****
I realized this on the search and list form so now I can use complex search operator and the performFind for all entity. What do you thinks about that ?

I will open an issue.

Nicolas


--
logoNrd <https://nereide.fr/>
        Nicolas Malin
The apache way <http://theapacheway.com/> : *Openness* Technical decisions are made publicly
informat...@nereide.fr
8 rue des Déportés 37000 TOURS, 02 47 50 30 54

Apache OFBiz <http://ofbiz.apache.org/>|The Apache Way <http://theapacheway.com/>|ofbiz-fr <http://www.ofbiz-fr.org/>|réseau LE <http://www.libre-entreprise.org/>

Reply via email to