Skip to content

Commit

Permalink
Removed the automatic select all when focusing the search field.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jens Riisom Schultz committed Apr 30, 2012
1 parent 631f274 commit f7a391e
Showing 1 changed file with 13 additions and 19 deletions.
32 changes: 13 additions & 19 deletions web/scripts/vigu.toolbar.js
Expand Up @@ -15,10 +15,10 @@ Vigu.Toolbar = (function($) {
return {
/**
* Create the toolbar
*
*
* @param {jQuery} Dom node
* @param {String} Title in the menu
*
*
* @return undefined
*/
setup : function(node , title) {
Expand All @@ -30,34 +30,28 @@ Vigu.Toolbar = (function($) {
},
/**
* Render the toolbar
*
*
* @return undefined
*/
render : function () {
},
/**
* Get search field
*
*
* @param {jQuery} node Node
*
*
* @return {undefiend}
*/
addSearch : function(node) {
$('<input type="text">')
.attr('name', 'search')
.addClass('ui-corner-all')
.keypress(function(event) {
if ( event.which == 13 ) {
event.preventDefault();
Vigu.Grid.parameters.path = $('input[name="search"]').val();
Vigu.Grid.reload();
}
})
.click(function(){
this.select();
})
.focus(function(){
this.select();
if ( event.which == 13 ) {
event.preventDefault();
Vigu.Grid.parameters.path = $('input[name="search"]').val();
Vigu.Grid.reload();
}
})
.appendTo(node);
$('<button>')
Expand All @@ -66,19 +60,19 @@ Vigu.Toolbar = (function($) {
Vigu.Grid.parameters.path = '';
$('input[name="search"]').val('');
Vigu.Grid.reload();
})
})
.appendTo(node).button();
$('<button>')
.text('Reload')
.click(function(){
Vigu.Grid.reload();
})
})
.appendTo(node).button();
$('<button>')
.text('Auto Reload')
.click(function(){
Vigu.Grid.autoRefresh();
})
})
.appendTo(node).button();
}
};
Expand Down

0 comments on commit f7a391e

Please sign in to comment.