Any ways to change the order of column or add new column in the the grid view programmatically without touching the xml, I’am trying to modify the xml through an action-method but I have to refrest the browser page .
Thank help
bma-axelor
(Axelor Staff)
Juillet 26, 2023, 5:30
2
Hello,
To change the order of grid rows, you can add the orderby
attribute to the grid view.
I have attached the documentation for the grid view Grid View :: Axelor Documentation
Alternatively, you may refer to the GitHub link provided below.
<field name="partner" form-view="partner-form" grid-view="partner-grid"/>
<field name="company" form-view="company-form" grid-view="company-grid" width="140"
if="__config__.app.getApp('base')?.getEnableMultiCompany()"/>
<field name="invoice" form-view="invoice-form" grid-view="invoice-grid" width="140"/>
<field name="tradingName"
if="__config__.app.getApp('base')?.getEnableTradingNamesManagement()"
form-view="trading-name-form" grid-view="trading-name-grid" width="140"/>
<field name="statusSelect" width="90"/>
</grid>
<grid name="move-grid-period" orderBy="date,id" title="Account moves to validate"
model="com.axelor.apps.account.db.Move" canDelete="false" canNew="false">
<field name="date" width="90"/>
<field name="reference" width="200"/>
<field name="journal" form-view="journal-form" grid-view="journal-grid" width="200"/>
<field name="functionalOriginSelect"/>
<field name="period" form-view="period-form" grid-view="period-grid" width="120"
canEdit="false" canView="false"/>
<field name="partner" form-view="partner-form" grid-view="partner-grid"/>
<field name="company" form-view="company-form" grid-view="company-grid" width="140"/>
<field name="invoice" form-view="invoice-form" grid-view="invoice-grid" width="140"/>
If you have any other questions, please don’t hesitate to contact me.
Best regards,
bma-axelor:
order of grid columns
I meant another thing, to add a new column in a grid without explicitly touching xml files, (Example i have two columns code_product, description and i want to add other columns. For the final users modify xml could be a little complicated.
I saw that exists « slick.columnpicker.js » as a .js library i think it might do the job but i don’t know how to use it.
I have to implement something like this.