Merge pull request #377 from sosedoff/column-numstats
Add column context menu item to get numeric stats
This commit is contained in:
commit
31db9658e0
File diff suppressed because one or more lines are too long
@ -272,6 +272,7 @@
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li><a href="#" data-action="unique_values" data-counts="false">Unique Values</a></li>
|
||||
<li><a href="#" data-action="unique_values" data-counts="true">Unique Values + Counts</a></li>
|
||||
<li><a href="#" data-action="num_stats">Numeric stats (min/max/avg)</a></li>
|
||||
<li><a href="#" data-action="copy_name">Copy Column Name</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -675,6 +675,18 @@ function showUniqueColumnsValues(table, column, showCounts) {
|
||||
});
|
||||
}
|
||||
|
||||
// Show numeric stats on the field
|
||||
function showFieldNumStats(table, column) {
|
||||
var query = 'SELECT min(' + column + '), max(' + column + '), avg(' + column + ') FROM ' + table;
|
||||
|
||||
executeQuery(query, function(data) {
|
||||
$("#input").hide();
|
||||
$("#body").prop("class", "full");
|
||||
$("#results").data("mode", "query");
|
||||
buildTable(data);
|
||||
});
|
||||
}
|
||||
|
||||
function buildTableFilters(name, type) {
|
||||
getTableStructure(name, { type: type }, function(data) {
|
||||
if (data.rows.length == 0) {
|
||||
@ -843,6 +855,13 @@ function bindTableHeaderMenu() {
|
||||
menuItem.data("counts") // display counts
|
||||
);
|
||||
break;
|
||||
|
||||
case "num_stats":
|
||||
showFieldNumStats(
|
||||
$("#results").data("table"), // table name
|
||||
$(context).data("name") // column name
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user