Просмотр исходного кода

+ set filter view selected in TableAjax SelectedInfo btn

Piotr Labudda 5 лет назад
Родитель
Сommit
4701b45fdb
2 измененных файлов с 17 добавлено и 1 удалено
  1. 9 0
      SE/se-lib/TableAjax.php.TableAjax.js
  2. 8 1
      SE/se-lib/TableAjax.php.p5UI__selected.js

+ 9 - 0
SE/se-lib/TableAjax.php.TableAjax.js

@@ -1139,6 +1139,15 @@ var TableAjax = function() {
 						store: priv.options.selectedStore,
 						actions: priv.options.selectedActions,
 						tools: priv.options.selectedFunctions,
+						onSetFilterSelected: function () {
+							DBG && console.log('DBG:onSetFilterSelected');
+							var filterActions = priv.options.filterActions;
+							var filterStore = priv.options.filterStore;
+							var checkboxIdContext = priv.options.checkboxIdContext;
+							var fieldName = ( checkboxIdContext ? '@sel_' + checkboxIdContext : '@selected' );
+
+							filterStore.dispatch( filterActions.setFilter(fieldName, 'YES') );
+						},
 						onSelectAllMatching: function () {
 							// TODO: priv.filter_mapStoreToState(priv.options.filterStore.getState())
 							var filterQuery = priv.filter_getFilterQuery();

+ 8 - 1
SE/se-lib/TableAjax.php.p5UI__selected.js

@@ -121,6 +121,10 @@ var P5UI__TableAjaxSelectedInfo = createReactClass({
 		// this.props.store.dispatch( this.props.actions.unselectAll( this.props.namespace ) )
 		this.props.onSelectAllMatching()
 	},
+	handleSetViewFilterViewMatching: function (event) {
+		DBG && console.log('DBG::P5UI__TableAjaxSelectedInfo::handleSetViewFilterViewMatching (ns:'+this.props.namespace+')');
+		this.props.onSetFilterSelected();
+	},
 	handleToggle: function () {
 		DBG1 && console.log('DBG::P5UI__TableAjaxSelectedInfo::handleToggle (ns:' + this.props.namespace + ')', { open: this.state.open });
 		this.setState({ open: !this.state.open }, this.state.open ? this._unbindCloseDropdownActions : this._bindCloseDropdownActions)
@@ -260,7 +264,10 @@ var P5UI__TableAjaxSelectedInfo = createReactClass({
 
 			h('div', { className: "btn-group" + (this.state.open ? " open" : "") }, [
 				// h('a', { className: "btn btn-xs btn-default" }, "Wybrano " + this.state.totalSelected),
-				h('button', { className: "btn btn-xs btn-default" }, "Wybrano " + this.state.totalSelected),
+				h('button', {
+					className: "btn btn-xs btn-default",
+					onClick: this.handleSetViewFilterViewMatching,
+				}, "Wybrano " + this.state.totalSelected),
 				this.renderClearBtn(),
 				this.renderToolsBtn(),
 				this.renderToolsMenu(),