added autocomplete to the username input box in the project map view
This commit is contained in:
parent
4d2025c5f4
commit
053374907c
@ -67,6 +67,8 @@ var GraphApp = (function()
|
|||||||
this.graph = null;
|
this.graph = null;
|
||||||
this.data = null;
|
this.data = null;
|
||||||
|
|
||||||
|
this.initial_uids = null;
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,6 +123,19 @@ var GraphApp = (function()
|
|||||||
return gd;
|
return gd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_all_unique_uids (data)
|
||||||
|
{
|
||||||
|
var uids = {};
|
||||||
|
for (var prid in data)
|
||||||
|
{
|
||||||
|
for (var i = 0; i < data[prid].length; i++)
|
||||||
|
{
|
||||||
|
uids[data[prid][i]] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Object.keys(uids);
|
||||||
|
}
|
||||||
|
|
||||||
function handle_double_click (nodeid)
|
function handle_double_click (nodeid)
|
||||||
{
|
{
|
||||||
// TODO: store node-id to name mapping and use it
|
// TODO: store node-id to name mapping and use it
|
||||||
@ -158,6 +173,12 @@ var GraphApp = (function()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (this.initial_uids == null || this.initial_uids.length <= 0)
|
||||||
|
{
|
||||||
|
this.initial_uids = get_all_unique_uids.call (this, data);
|
||||||
|
this.filter.autocomplete('option', 'source', this.initial_uids);
|
||||||
|
}
|
||||||
|
|
||||||
this.data = convert_data.call (this, data);
|
this.data = convert_data.call (this, data);
|
||||||
if (this.graph === null)
|
if (this.graph === null)
|
||||||
{
|
{
|
||||||
@ -226,6 +247,12 @@ var GraphApp = (function()
|
|||||||
this.filter.button().bind ('keyup', function(e) {
|
this.filter.button().bind ('keyup', function(e) {
|
||||||
if (e.keyCode == 13) self.triggerRefresh ();
|
if (e.keyCode == 13) self.triggerRefresh ();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.filter.autocomplete ({
|
||||||
|
minLength: 1, // is this too small?
|
||||||
|
delay: 500,
|
||||||
|
source: [] // to be set upon the first data load
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
App.prototype.refresh = function (filter)
|
App.prototype.refresh = function (filter)
|
||||||
|
Loading…
Reference in New Issue
Block a user