Get filterheaders working

This commit is contained in:
Nathan Gray 2011-09-27 17:58:10 +00:00
parent 4e8fe1bb2c
commit 36c39cf4b8
2 changed files with 20 additions and 4 deletions

View File

@ -117,16 +117,17 @@ class etemplate_widget_nextmatch extends etemplate_widget
*
* @param string $exec_id identifys the etemplate request
* @param array $fetchList array of array with values for keys "startIdx" and "count"
* @param array $filters Search and filter parameters, passed to data source
* @param string full id of widget incl. all namespaces
* @return array with values for keys 'total', 'rows', 'readonlys'
*/
static public function ajax_get_rows($exec_id, $fetchList, $filters = array(), $form_name='nm')
{
error_log(__METHOD__."('".substr($exec_id,0,10)."...',".array2string($fetchList).",'$form_name')");
error_log(__METHOD__."('".substr($exec_id,0,10)."...',".array2string($fetchList).','.array2string($filters).",'$form_name')");
self::$request = etemplate_request::read($exec_id);
$value = self::get_array(self::$request->content, $form_name, true);
$value += $filters;
$value = array_merge($value, $filters);
$result = array('rows' => array());
foreach ($fetchList as $entry)

View File

@ -491,7 +491,8 @@ var et2_nextmatch_header_bar = Class.extend(et2_INextmatchHeader, {
.addClass("header_count")
.appendTo(this.div);
this.count.append("? - ? ").append(egw.lang("of")).append(" ");
// Need to figure out how to update this as grid scrolls
//this.count.append("? - ? ").append(egw.lang("of")).append(" ");
this.count_total = jQuery(document.createElement("span"))
.appendTo(this.count)
.text(settings.total + "");
@ -597,7 +598,7 @@ var et2_nextmatch_header_bar = Class.extend(et2_INextmatchHeader, {
});
}
},
/**
* Build the selectbox filters in the header bar
* Sets value, options, labels, and change handlers
@ -728,6 +729,20 @@ et2_register_widget(et2_nextmatch_sortheader, ['nextmatch-sortheader']);
var et2_nextmatch_filterheader = et2_selectbox.extend(et2_INextmatchHeader, {
/**
* Override to add change handler
*/
createInputWidget: function() {
this._super.apply(this, arguments);
this.input.change(this, function(event) {
if(typeof event.data.nextmatch.activeFilters.col_filter == 'undefined')
event.data.nextmatch.activeFilters.col_filter = {};
event.data.nextmatch.activeFilters["col_filter"][event.data.id] = event.data.input.val()
event.data.nextmatch.applyFilters();
});
},
/**
* Set nextmatch is the function which has to be implemented for the
* et2_INextmatchHeader interface.