Adding a tab in an extends view

Hello,

I want to add a tab in an extends view when I do it like this:

<extend target="//panel[@name='timeSpentPanel']">
      <insert position="after">
        <panel-tabs name="financialPanelTab">

          <panel name="financialPanel" title="financial">
            <field name="test" title="test"/>
          </panel>
        </panel-tabs>

      </insert>
    </extend>
  </form>

I get this error when I refresh my views anyone have an idea ?

Caused by: Exception [EclipseLink-25004] (Eclipse Persistence Services - 2.6.4.v20160829-44060b6): org.eclipse.persistence.exceptions.XMLMarshalException
Exception Description: An error occurred unmarshalling the document
Internal Exception: org.xml.sax.SAXParseExceptionpublicId: ; systemId: ; lineNumber: 0; columnNumber: 0; cvc-complex-type.2.4.a: Invalid content was found starting with element 'panel-tabs'. One of '{"http://axelor.com/xml/ns/object-views":panel, "http://axelor.com/xml/ns/object-views":panel-related, "http://axelor.com/xml/ns/object-views":panel-dashlet, "http://axelor.com/xml/ns/object-views":panel-include}' is expected.
	at org.eclipse.persistence.exceptions.XMLMarshalException.unmarshalException(XMLMarshalException.java:120)
	at org.eclipse.persistence.internal.oxm.record.SAXUnmarshaller.convertSAXException(SAXUnmarshaller.java:1043)
	at org.eclipse.persistence.internal.oxm.record.SAXUnmarshaller.unmarshal(SAXUnmarshaller.java:623)
	at org.eclipse.persistence.internal.oxm.record.SAXUnmarshaller.unmarshal(SAXUnmarshaller.java:563)
	at org.eclipse.persistence.internal.oxm.XMLUnmarshaller.unmarshal(XMLUnmarshaller.java:550)
	at org.eclipse.persistence.jaxb.JAXBUnmarshaller.unmarshal(JAXBUnmarshaller.java:323)
	... 117 more
Caused by: org.xml.sax.SAXParseExceptionpublicId: ; systemId: ; lineNumber: 0; columnNumber: 0; cvc-complex-type.2.4.a: Invalid content was found starting with element 'panel-tabs'. One of '{"http://axelor.com/xml/ns/object-views":panel, "http://axelor.com/xml/ns/object-views":panel-related, "http://axelor.com/xml/ns/object-views":panel-dashlet, "http://axelor.com/xml/ns/object-views":panel-include}' is expected.
	at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
	at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
	at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
	at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
	at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
	at org.apache.xerces.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown Source)
	at org.apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown Source)
	at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source)
	at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown Source)
	at org.apache.xerces.jaxp.validation.ValidatorHandlerImpl.startElement(Unknown Source)
	at org.eclipse.persistence.internal.oxm.record.XMLReader$ValidatingContentHandler.startElement(XMLReader.java:471)
	at org.eclipse.persistence.internal.oxm.record.XMLReaderAdapter$ExtendedContentHandlerAdapter.startElement(XMLReaderAdapter.java:178)
	at org.eclipse.persistence.internal.oxm.record.DOMReader.reportElementEvents(DOMReader.java:196)
	at org.eclipse.persistence.internal.oxm.record.DOMReader.reportElementEvents(DOMReader.java:140)
	at org.eclipse.persistence.internal.oxm.record.DOMReader.handleChildNodes(DOMReader.java:295)
	at org.eclipse.persistence.internal.oxm.record.DOMReader.reportElementEvents(DOMReader.java:198)
	at org.eclipse.persistence.internal.oxm.record.DOMReader.reportElementEvents(DOMReader.java:140)
	at org.eclipse.persistence.internal.oxm.record.DOMReader.handleChildNodes(DOMReader.java:295)
	at org.eclipse.persistence.internal.oxm.record.DOMReader.reportElementEvents(DOMReader.java:198)
	at org.eclipse.persistence.internal.oxm.record.DOMReader.reportElementEvents(DOMReader.java:140)
	at org.eclipse.persistence.internal.oxm.record.DOMReader.handleChildNodes(DOMReader.java:295)
	at org.eclipse.persistence.internal.oxm.record.DOMReader.reportElementEvents(DOMReader.java:198)
	at org.eclipse.persistence.internal.oxm.record.DOMReader.parse(DOMReader.java:94)
	at org.eclipse.persistence.internal.oxm.record.DOMReader.parse(DOMReader.java:101)
	at org.eclipse.persistence.internal.oxm.record.SAXUnmarshaller.unmarshal(SAXUnmarshaller.java:621)
	... 120 more

Hello,

This part looks OK, however it looks like the XML file is malformed.

The view begins well with

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<object-views xmlns="http://axelor.com/xml/ns/object-views"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://axelor.com/xml/ns/object-views http://axelor.com/xml/ns/object-views/object-views_5.4.xsd">

  <form id="..." model="…"  title="..." name="…." extension="true">

Hello PakMax,

Thanks for your help.
I have this :

<?xml version="1.0" encoding="UTF-8"?>
<object-views xmlns="http://axelor.com/xml/ns/object-views"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://axelor.com/xml/ns/object-views
  http://axelor.com/xml/ns/object-views/object-views_5.4.xsd">

  <form name="project-task-form" title="Task" model="com.axelor.apps.project.db.ProjectTask"
onNew="action-project-task-group-onnew" onLoad="action-project-task-group-timer-process"
width="large" id="order-projectTask-form" extension="true">

an problem ?

I suspect your misunderstood the principle of panel tabs.

In your xml you want to a panel-tabs but I think you want to add only a tab in your existant menu.
If you have already a menu panel-tabs, you simply need to add a panel (which is a tab of your menu) and not a panel-tabs which is a complete menu.

So the code should be :

<extend target="//panel[@name='timeSpentPanel']">
      <insert position="after">
          <!-- removed panel-tabs here -->
          <panel name="financialPanel" title="financial">
            <field name="test" title="test"/>
          </panel>
      </insert>
    </extend>
  </form>

I already have a panel-tabs indeed and I just want to add a tab after the existing tab with this name //panel[@name=‹ timeSpentPanel ›]

that’s why I put an after and insert with just a panel. But it does not work.

Show us your full code if it’s not solved

Hello PHPierre,

Thanks for your help, this is my full code for you :

<?xml version="1.0" encoding="UTF-8"?>
<object-views xmlns="http://axelor.com/xml/ns/object-views"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://axelor.com/xml/ns/object-views
  http://axelor.com/xml/ns/object-views/object-views_5.4.xsd">

 <form name="project-task-form" title="Task" model="com.axelor.apps.project.db.ProjectTask"
    onNew="action-project-task-group-onnew" onLoad="action-project-task-group-timer-process"
    width="large" id="ordered-projectTask-form" extension="true">

 <extend target="//panel[@name='frequencyPanel']">
      <attribute name="hidden" value="true"/>
    </extend>

    <!-- <panel-tabs name="mainPanelTab"> -->
    <extend target="//panel[@name='timeSpentPanel']">
      <insert position="after">
        <panel name="financialPanel" title="financial">
          <field name="test" title="test"/>
        </panel>
      </insert>
    </extend>
  </form>

</object-views>

Does the frequencyPanel is hidden successfully ? Your code seems right.
Can you edit the view in Axelor to see if your extension is added ?

yes the frequency tab is well hidden when I comment on the addition of the new tab. If not It is when I refresh my views that I have the error message concerning the addition of the new tab. So I was never able to see my changes reflected in the view.

Hello,
Please delete extension view of project-task-form. After that restore all.

1 « J'aime »

pff that’s good, no change needed in my code. Great wasted time for nothing…lol Thanks for the help you guys are the best

Ce sujet a été automatiquement fermé après 30 jours. Aucune réponse n’est permise dorénavant.