on 2018 Jan 29 9:14 AM
Hey guys,
is there any possible way to enable inline editing in the multireferenceeditor only for single columns in the cockpitNG and not for the complete row? Some columns should be limited to not be editable Or is there any way to configure it with user rights? I restricted the user to be able to change and read an attribute but the only thing that happens is that it shows "you have no permission" but I am still able to edit it via inline editing
Request clarification before answering.
Hi ,
I'm afraid that it is not that simple to override a renderer in ExtendedMultireferenceEditor. After looking closer to the source, I have few comments to what you posted:
you may set spring-bean on column level, but it needs to point to a spring bean of com.hybris.cockpitng.widgets.common.WidgetComponentRenderer type
a bean specified on column level is used only to render a readable representation of column value (i.e. a label, icon, etc.) - it cannot define if and/or how a value is editable
you can change a default cell renderer for ExtendedMultireferenceEditor by defining a new bean of type com.hybris.cockpitng.editor.extendedmultireferenceeditor.renderer.CellRenderer (may extend com.hybris.cockpitng.editor.extendedmultireferenceeditor.renderer.DefaultCellRenderer), but please bare in mind that it will change it globally (for all instances of editor)
changing a cell editor for a single instance of editor would require defining your custom editor that would create your custom implementation of row renderer in com.hybris.cockpitng.editor.extendedmultireferenceeditor.DefaultExtendedMultiReferenceEditor#createReferenceLayout method.
Cheers, Jacek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
thanks for your answer. I'm currently using my own class which extends the DefaultCellRenderer because I only want to edit one cell if it equals some pattern. It's giving me nullpointers right now when he is checking at:
if (isAtomicAttribute(cellContext))
and
else if (isCompletxAttribute(cellContext))
inside the DefaultCellRenderer.
Also he's not using my code even though I defined a bean inside my spring.xml and assigned it inside my cockpit.xml
cockpit.xml
<list-view:column qualifier="cavokMedia" id="cavokmedia" spring-bean="premCavokMediaLabelRenderer"/>
spring.xml
<alias name="premCavokMediaLabelRenderer" alias="cavokMediaLabelRenderer"/>
<bean id="premCavokMediaLabelRenderer"
class="ecx.io.prem.pim.backoffice.widgets.renderer.PremCavokMediaMultiReferenceEditorLabelRenderer">
<property name="typeFacade" ref="typeFacade"/>
<property name="objectValueService" ref="objectValueService"/>
<property name="labelService" ref="labelService"/>
<property name="permissionFacade" ref="permissionFacade"/>
<property name="validationRenderer" ref="validationRenderer"/>
</bean>
My code:
public class PremCavokMediaMultiReferenceEditorLabelRenderer extends DefaultCellRenderer<T>
{
@Override
public void render(final CellContext<T> cellContext)
{
for (final DataAttribute attribute : cellContext.getRowEntryDataType().getAttributes())
{
if (attribute.equals("cavokMedia"))
{
cellContext.setInlineEditingEnabled(false);
}
}
super.render(cellContext);
}
Any ideas?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
I'm afraid that there is no such feature ootb. You could consider extending the default cell editor and add there some custom logic. Please take a look at com.hybris.cockpitng.editor.extendedmultireferenceeditor.renderer.DefaultCellRenderer and com.hybris.cockpitng.editor.extendedmultireferenceeditor.renderer.DefaultRowRenderer. I would put your customization here.
Cheers, Jacek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.