Hi all,
Is there a way to customise the + button on the FilterableBeanCollectionModule to open the entity instead of creating an empty line and clicking on the Open button? Any suggestions?
Thanks
Gayathri
Hi all,
Is there a way to customise the + button on the FilterableBeanCollectionModule to open the entity instead of creating an empty line and clicking on the Open button? Any suggestions?
Thanks
Gayathri
Hello Gayathri
I think it’s quite simple :
1. override your filter module to change the table view representation :
<bean
parent="abstractFilterableBeanCollectionModule">
<property
name="projectedViewDescriptor"
ref="User.module.view" />
<property
name="elementComponentDescriptor"
ref="User" />
<property
name="name"
value="Users" />
<property
name="description"
value="Users.description" />
</bean>
2. redefine the table view’s action map (reuse all std action except the add action)
<bean
id="User.module.view"
parent="filterableBeanCollectionModuleView"
class="org.jspresso.framework.view.descriptor.basic.BasicTableViewDescriptor" >
<property
name="actionMap"
ref="adminFilterModuleActionMap" />
<property
name="borderType"
value="SIMPLE" />
<property
name="modelDescriptor"
ref="User" />
</bean>
<bean
id="adminFilterModuleActionMap"
class="org.jspresso.framework.view.action.ActionMap" >
<property
name="parentActionMaps">
<list>
<ref
bean="readonlyBeanCollectionModuleActionMap" />
</list>
</property>
<property
name="actionLists">
<list>
<bean
class="org.jspresso.framework.view.action.ActionList" >
<property
name="name"
value="ACTION" />
<property
name="actions">
<list>
<ref
bean="addToMasterAndAddAsChildModuleFrontAction" />
<ref
bean="cloneEntityCollectionFrontAction" />
<ref
bean="removeFromModuleObjectFrontAction" />
</list>
</property>
</bean>
<bean
class="org.jspresso.framework.view.action.ActionList" >
<property
name="name"
value="FILE" />
<property
name="actions">
<list>
<ref
bean="queryModuleFilterAction" />
</list>
</property>
</bean>
</list>
</property>
</bean>
3. code your specific add action :
you just have to create an action that inherit from standard “Add” action and chain to the standard “Add as child” action :
<bean
id="addToMasterAndAddAsChildModuleFrontAction"
parent="addToMasterFrontAction">
<property
name="nextAction">
<ref bean ="addAsChildModuleFrontAction" />
</property>
</bean>
Regards
Maxime
Thanks Maxim for your detailed explanation. This will help me greatly.
Thanks
Gayathri
is it possible to translate this xml in groovy ???
i didn't manage to do it
thanks
david
David,
here is the SJS version :
table 'User.module.view',
actionMap:'adminFilterModuleActionMap',
borderType:'SIMPLE'
action 'addToMasterAndAddAsChildModuleFrontAction',
parent:'addToMasterFrontAction',
next:'addAsChildModuleFrontAction'
actionMap('adminFilterModuleActionMap',
parents:['readonlyBeanCollectionModuleActionMap']) {
actionList('ACTION') {
action ref:'addToMasterAndAddAsChildModuleFrontAction'
action ref:'cloneEntityCollectionFrontAction'
action ref:'removeFromModuleObjectFrontAction'
}
actionList('FILE') { action ref:'queryModuleFilterAction' }
}
filterModule('Users',
description:'Users.description'
moduleView:'User.module.view',
component:'User')
Best,
Vincent