mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-18 11:55:46 +08:00
Added onResult function to type ahead
This commit is contained in:
parent
234cf31d3f
commit
781e4ffd4f
@ -117,6 +117,15 @@ define(function(require){
|
|||||||
mod.modal('hide');
|
mod.modal('hide');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Whenever a result is rendered, if there is only one resulting
|
||||||
|
* element then automatically select that element.
|
||||||
|
*/
|
||||||
|
var onResult = function(node, query, result, resultCount) {
|
||||||
|
if (resultCount == 1) {
|
||||||
|
$('.typeahead-list > li:nth-child(2)').addClass('active');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// generate structure needed for typeahead layout and ability to search
|
// generate structure needed for typeahead layout and ability to search
|
||||||
var src = {};
|
var src = {};
|
||||||
|
|
||||||
@ -164,7 +173,8 @@ define(function(require){
|
|||||||
source: src,
|
source: src,
|
||||||
callback: {
|
callback: {
|
||||||
onSubmit: onSubmit,
|
onSubmit: onSubmit,
|
||||||
onClickAfter: onSubmit
|
onClickAfter: onSubmit,
|
||||||
|
onResult: onResult
|
||||||
},
|
},
|
||||||
debug: false,
|
debug: false,
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user