[fix] remove filter

This commit is contained in:
Rushabh Mehta 2017-09-29 12:10:34 +05:30
parent e41e857257
commit 630d30d89a
2 changed files with 21 additions and 1 deletions

View file

@ -128,6 +128,19 @@ frappe.ui.FilterList = Class.extend({
return filter; return filter;
}, },
remove: function(filter) {
// remove `filter` from flist
for (var i in this.filters) {
if (this.filters[i] === filter) {
break;
}
}
if (i!==undefined) {
// remove index
this.splice(i, 1);
}
},
filter_exists: function(doctype, fieldname, condition, value) { filter_exists: function(doctype, fieldname, condition, value) {
var flag = false; var flag = false;
for(var i in this.filters) { for(var i in this.filters) {
@ -261,9 +274,11 @@ frappe.ui.Filter = Class.extend({
apply: function() { apply: function() {
var f = this.get_value(); var f = this.get_value();
this.flist.filters.pop();
this.flist.remove(this);
this.flist.push_new_filter(f[0], f[1], f[2], f[3]); this.flist.push_new_filter(f[0], f[1], f[2], f[3]);
this.wrapper.remove(); this.wrapper.remove();
this.flist.update_filters();
}, },
remove: function(dont_run) { remove: function(dont_run) {

View file

@ -38,6 +38,11 @@ io.on('connection', function(socket) {
} }
// console.log("connection!"); // console.log("connection!");
if (!socket.request.headers.cookie) {
return;
}
var sid = cookie.parse(socket.request.headers.cookie).sid var sid = cookie.parse(socket.request.headers.cookie).sid
if(!sid) { if(!sid) {
return; return;