Fix search method in vfsSelect dialog

This commit is contained in:
Hadi Nategh 2019-07-30 12:26:26 +02:00
parent 053a2aeefd
commit a68f9f54b7

View File

@ -327,22 +327,22 @@ app.classes.vfsSelectUI = (function(){ "use strict"; return AppJS.extend(
dir.set_value({content: this.dirContent}); dir.set_value({content: this.dirContent});
return; return;
} }
var self = this;
var searchQuery = function (_query) var searchQuery = function (_query)
{ {
var result = {}; var result = {};
var reg = RegExp(_query, 'ig'); var reg = RegExp("^"+_query, 'ig');
var content = dir.getArrayMgr('content').data;
var key = 0; var key = 0;
for (var i in content) for (var i in self.dirContent)
{ {
if (typeof content[i]['name'] != 'undefined' && content[i]['name'].match(reg)) if (typeof self.dirContent[i]['name'] != 'undefined' && self.dirContent[i]['name'].match(reg))
{ {
result[key] = content[i]; result[key] = self.dirContent[i];
key++; key++;
} }
else if (typeof content[i]['name'] == 'undefined' && isNaN(i)) else if (typeof self.dirContent[i]['name'] == 'undefined' && isNaN(i))
{ {
result[i] = content[i]; result[i] = self.dirContent[i];
} }
} }
return result; return result;