jQuery UI Widgets › Forums › Grid › Problem with StatusBar and Aggergates
Tagged: jquery datagrid aggregates
This topic contains 7 replies, has 4 voices, and was last updated by TP_DTNA 8 years, 12 months ago.
-
Author
-
In this example my status bar works great until I set showaggregates: true. Then my status bar disappears. Can you help me with this?
$(jqxgrid).jqxGrid({
theme: theme,
width: ‘99.9%’,
height: 300,
source: dataAdapter,
scrollbarsize: 10,
sortable: true,
sorttogglestates: 1,
altrows: true,
virtualmode: false,
enablehover: false,
enabletooltips: false,
autoheight: false,
autosavestate: false,
autoloadstate: false,
columnsresize: true,
columnsreorder: false,
editable: true,
selectionmode: “singlecell”,
filterable: true,
showfilterrow: true,
statusbarheight: 26,
showstatusbar: true,
showaggregates: true,
renderstatusbar: function (statusbar) {
var container = $(““);
var table = $(“”);
table.appendTo(container);var tableRow = $(“”);
tableRow.appendTo(table);var tableLeft = $(“”);
tableLeft.appendTo(tableRow);var tableCenter = $(“”);
tableCenter.appendTo(tableRow);var tableRight = $(“”);
tableRight.appendTo(tableRow);var refreshButton = $(“
“);
refreshButton.find(‘span’).addClass(‘ui-icon ui-icon-refresh’);
refreshButton.width(16);
refreshButton.jqxTooltip({ content: ‘Refresh Grid!’, position: ‘mouse’, name: ‘Tooltip’, theme: theme });
refreshButton.appendTo(tableLeft);var recalculateButton = $(“
“);
recalculateButton.find(‘span’).addClass(‘ui-icon ui-icon-arrowstop-1-n’);
recalculateButton.width(16);
recalculateButton.jqxTooltip({ content: ‘Recalculate!’, position: ‘mouse’, name: ‘Tooltip’, theme: theme });
recalculateButton.appendTo(tableLeft);var pagingLabel = $(“
“);
pagingLabel.text(“Records”);
pagingLabel.appendTo(tableCenter);statusbar.append(container);
refreshButton.click(function (event) {
$(jqxgrid).jqxGrid(‘updatebounddata’);
});recalculateButton.click(function (event) {
if(selectedID>0){
$(“#message”).html(“Recalculate”);
$.ajax({
type: “POST”,
url: “../Bid/BidRecaculateJSON.php”,
data: { BidID: selectedID}
}).done(function( msg ) {
$(“#message”).html(“Transaction: ” + msg);
$(jqxgrid).jqxGrid(‘updatebounddata’);
});
}else{
$(“#message”).html(“You must select a Bid!”);
}
});
},Hi David,
The Grid’s Column Aggregates are displayed in the StatusBar area. You are not able to render custom widgets into that area in case you wish the built-in aggregates to be displayed.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comThanks…
Do you plan to correct the issue with the Aggregator returning incorrect results when the column does not contain values for each row.
Hi David,
Please, provide a sample which demonstrates the new issue that you have.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comExample:
2 columns
Product a = 10
Product b = 0
Product c = 10
product d = 0
product e = 0Aggregates ‘avg’ return 20/5 = 4 instead I need 20/2 = 10
Is it possible?
Marco
anyone?
Is it a solution to just implement a custom aggregate function, one that ignores rows you don’t want in the average?
There’s a aggregate property in the column definition, looks like:
aggregates: [‘count’, {
‘Cappuccino Items’: function (aggregatedValue, currentValue) {
if (currentValue == “Cappuccino”) {
return aggregatedValue + 1;
}
return aggregatedValue;
}
}]example seen here: http://jsfiddle.net/jqwidgets/3y7RN/
-
AuthorPosts
You must be logged in to reply to this topic.