|
@@ -1823,6 +1823,10 @@ var p5UI_TableAjax_generateFunctionNode = function(funObj, rowPK, props) {
|
|
|
selected = (selectedFilter && selectedFilter == colFltr.name)? 'checked="checked"' : '',
|
|
selected = (selectedFilter && selectedFilter == colFltr.name)? 'checked="checked"' : '',
|
|
|
input = '<input ' + selected + ' type="radio" style="margin:0"/>',
|
|
input = '<input ' + selected + ' type="radio" style="margin:0"/>',
|
|
|
a = $('<a href="#" data-col_filter="' + colFltr.name + '" style="padding:0px 20px;">' + input + ' ' + colFltr.label + '</a>').appendTo(li);
|
|
a = $('<a href="#" data-col_filter="' + colFltr.name + '" style="padding:0px 20px;">' + input + ' ' + colFltr.label + '</a>').appendTo(li);
|
|
|
|
|
+ if ('all' != colFltr && 'most_used' != colFltr) {
|
|
|
|
|
+ arm = $('<button data-col_filter="' + colFltr.name + '" class="pull-right btn btn-xs btn-link" style="color:red">' + '×' + '</a>').appendTo(a);
|
|
|
|
|
+ arm.on('click', priv.modelColFilter_onClickRemoveFilter)
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
{// if (!selectedFilter) {// save current filter
|
|
{// if (!selectedFilter) {// save current filter
|
|
@@ -2846,6 +2850,44 @@ var p5UI_TableAjax_generateFunctionNode = function(funObj, rowPK, props) {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
+ priv.modelColFilter_onClickRemoveFilter = function (e) {
|
|
|
|
|
+ e.preventDefault()
|
|
|
|
|
+ e.stopPropagation()
|
|
|
|
|
+ var filtrName = $(this).data('col_filter')
|
|
|
|
|
+ if (!filtrName) return
|
|
|
|
|
+ fetch('<?= Request::getPathUri() . "index.php?_route=ViewTableAjax&_task=rmUserTableFilterAjax" ?>', {
|
|
|
|
|
+ method: 'POST',
|
|
|
|
|
+ headers: {
|
|
|
|
|
+ 'Content-Type': 'application/json'
|
|
|
|
|
+ },
|
|
|
|
|
+ credentials: 'same-origin',// add cookies
|
|
|
|
|
+ body: JSON.stringify({
|
|
|
|
|
+ namespace: '<?= $acl->getNamespace(); ?>',
|
|
|
|
|
+ filtrName: filtrName,
|
|
|
|
|
+ })
|
|
|
|
|
+ }).then(function (response) {
|
|
|
|
|
+ return response.json()
|
|
|
|
|
+ }).then(function (result) {
|
|
|
|
|
+ if ('success' == result.type) {
|
|
|
|
|
+ p5UI__notifyAjaxCallback(result)
|
|
|
|
|
+ var userTableFilters = result.data;// resolve(result.data)
|
|
|
|
|
+ _state._modelColFilter.filters = _state._modelColFilter.filters.filter(function (filter) {
|
|
|
|
|
+ return ('all' === filter.name || 'most_used' == filter.name)
|
|
|
|
|
+ }).concat(Object.keys(userTableFilters).map(function (fltr) {
|
|
|
|
|
+ return {
|
|
|
|
|
+ name: fltr,
|
|
|
|
|
+ label: fltr,
|
|
|
|
|
+ visibleCols: userTableFilters[fltr].split(',')
|
|
|
|
|
+ }
|
|
|
|
|
+ }))
|
|
|
|
|
+ jQuery(_uiNodeCont).trigger('TableAjax:render', ['foot__columnPicker']);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ p5UI__notifyAjaxCallback(result)
|
|
|
|
|
+ }
|
|
|
|
|
+ }).catch(function (e) {
|
|
|
|
|
+ p5UI__notifyAjaxCallback({ type: 'error', msg: new String(e) })
|
|
|
|
|
+ });
|
|
|
|
|
+ };
|
|
|
priv.modelColFilter_saveBtnClicked = function (e) {
|
|
priv.modelColFilter_saveBtnClicked = function (e) {
|
|
|
swal({
|
|
swal({
|
|
|
title: 'Zapisz widoczne kolumny',
|
|
title: 'Zapisz widoczne kolumny',
|