JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › Data Grid › How to update summary row in grouping in data grid?
Tagged: Smart grid Grouping
- This topic has 1 reply, 2 voices, and was last updated 1 week, 4 days ago by admin.
-
AuthorPosts
-
November 9, 2024 at 7:26 am #111750Shahbaz AliParticipant
<smart-grid #grid id=”grid” [grouping]=”grouping”
[header]=”header”
[dataSource]=”summaryCenterdataAdapter”
[columns]=”summary_center_columns”
[columnGroups]=”columngroups”
></smart-grid>
this.summaryCenterdataAdapter = new Smart.DataAdapter({
dataSource: data,
groupBy: [‘center’],
dataFields: [
{ name: ‘product’, type: ‘string’ },
{ name: ‘center’, type: ‘string’ },
{ name: ‘reference_no’, type: ‘string’ },
{ name: ‘date’, type: ‘string’ },
{ name: ‘bar_no’, type: ‘string’ },
{ name: ‘bar_desc’, type: ‘string’ },
{ name: ‘gross_weight_balance’, type: ‘number’ },
{ name: ‘net_weight_balance’, type: ‘number’ },
{ name: ‘gross_weight_issued’, type: ‘number’ },
{ name: ‘net_weight_issued’, type: ‘number’ },
{ name: ‘gross_weight_opening’, type: ‘number’ },
{ name: ‘net_weight_opening’, type: ‘number’ },
{ name: ‘gross_weight_received’, type: ‘number’ },
{ name: ‘net_weight_received’, type: ‘number’ },
]
});this.behavior = { columnResizeMode: ‘growAndShrink’ }
this.grouping = {
enabled: true,
renderMode: ‘compact’,
autoHideGroupColumn:true,
groupBar: {
visible: false
},
summaryRow: {
inline: false
}}
this.header = {
visible: true
}
// this.summaryRow = { visible: true, summaryRowPosition: ‘bottom’ };
this.summary_center_columns = [
{ label: ‘Center’, dataField: ‘center’, width: 15, cellsAlign: ‘left’, align: ‘center’},
{ label: ‘Product’, dataField: ‘product’,width:250, cellsAlign: ‘left’, align: ‘center’, freeze: true ,allowGroup:false},
{label: ‘GW (g)’, dataField: ‘gross_weight_opening’, width: this.value, cellsAlign: ‘right’, align: ‘center’, cellsFormat: ‘f3’,allowGroup:false,columnGroup: ‘opening’,summary: [‘sum’]},
{label: ‘NW (g)’, dataField: ‘net_weight_opening’, width: this.value, cellsAlign: ‘right’, align: ‘center’, cellsFormat: ‘f3’,allowGroup:false,columnGroup: ‘opening’,summary: [‘sum’]},
{label: ‘GW (g)’, dataField: ‘gross_weight_received’, width: this.value, cellsAlign: ‘right’, align: ‘center’, cellsFormat: ‘f3’,allowGroup:false,columnGroup: ‘received’,summary: [‘sum’]},
{label: ‘NW (g)’, dataField: ‘net_weight_received’, width: this.value, cellsAlign: ‘right’, align: ‘center’, cellsFormat: ‘f3’,allowGroup:false,columnGroup: ‘received’,summary: [‘sum’]},
{label: ‘GW (g)’, dataField: ‘gross_weight_issued’, width: this.value, cellsAlign: ‘right’, align: ‘center’, cellsFormat: ‘f3’,allowGroup:false,columnGroup: ‘issued’,summary: [‘sum’]},
{label: ‘NW (g)’, dataField: ‘net_weight_issued’, width: this.value, cellsAlign: ‘right’, align: ‘center’, cellsFormat: ‘f3’,allowGroup:false,columnGroup: ‘issued’,summary: [‘sum’]},
{label: ‘GW (g)’, dataField: ‘gross_weight_balance’, width: this.value, cellsAlign: ‘right’, align: ‘center’, cellsFormat: ‘f3’,allowGroup:false,columnGroup: ‘balance’,summary: [‘sum’]},
{label: ‘NW (g)’, dataField: ‘net_weight_balance’, width: this.value, cellsAlign: ‘right’, align: ‘center’, cellsFormat: ‘f3’,allowGroup:false,columnGroup: ‘balance’,summary: [‘sum’],
getCellValue: (id:any, dataField:any, data:any) => {
// console.warn(‘id’,id)
// console.warn(‘data’,data)
}}]
In above code I applied grouping on the center named field and I’ve set the property named autoHideGroupColumn to true because I dont’t want to display the center as column in my grid because it’s already making groups on the bais of center and displying the center name as each group’s title but in the summary row it’s showing the summary total value of gross_weight_opening column in it’s previous column naned product why it’s doing this please make it correct Product column has no summary and it should display the gross_weight_opening column’ssummary in it’s column not in product’s column
I’m using below mentioned library
https://www.htmlelements.com/docs/
ChatGPT said:
ChatGPTNovember 11, 2024 at 9:57 pm #111758adminKeymasterHi,
We will need a stackblitz example and steps to reproduce the described behavior.
Best regards,
MarkovSmart UI Team
https://www.htmlelements.com/ -
AuthorPosts
- You must be logged in to reply to this topic.