Skip to content

Instantly share code, notes, and snippets.

@danil-z
Created March 9, 2011 20:27
Show Gist options
  • Save danil-z/862934 to your computer and use it in GitHub Desktop.
Save danil-z/862934 to your computer and use it in GitHub Desktop.
class ScheduleGrid < Netzke::Basepack::GridPanel
#....
# i think it's too annoing click "add row" button if you add many rows in grid
# this addition to gridpanel allow you add a row automaticaly
# when you finished edit last row and hit tab or enter
js_method :walk_cells, <<-JS
function(row, col, step, fn, scope) {
var cell = #{js_full_class_name}.superclass.walkCells.apply(this, arguments);
if (!cell&&step>0) {
this.onAdd();
// walk to first editable column of newly created row
row = this.getStore().getCount()-1;
col = 0;
cell = #{js_full_class_name}.superclass.walkCells.call(this, row, col, step, fn, scope);
}
return cell;
}
JS
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment