[#53,#27,view/query][s]: support for offset in query editor.

This commit is contained in:
Rufus Pollock
2012-02-24 09:29:17 +00:00
parent aaa01b2191
commit e32d541fc7

View File

@@ -177,13 +177,14 @@ my.DataExplorer = Backbone.View.extend({
my.QueryEditor = Backbone.View.extend({ my.QueryEditor = Backbone.View.extend({
className: 'recline-query-editor', className: 'recline-query-editor',
template: ' \ template: ' \
<form class="display-count"> \ <form action="" method="GET"> \
Showing 0 to <input name="displayCount" type="text" value="{{size}}" title="Edit and hit enter to change the number of rows displayed" /> of <span class="doc-count">{{docCount}}</span> \ Showing <input name="size" type="text" value="{{size}}" title="Edit and hit enter to change the number of rows displayed" /> starting at <input name="offset" type="text" value="{{offset}}" /> of <span class="doc-count">{{docCount}}</span> \
<button type="submit" class="btn">Update &raquo;</button> \
</form> \ </form> \
', ',
events: { events: {
'submit form.display-count': 'onFormSubmit' 'submit form': 'onFormSubmit'
}, },
initialize: function() { initialize: function() {
@@ -192,8 +193,9 @@ my.QueryEditor = Backbone.View.extend({
}, },
onFormSubmit: function(e) { onFormSubmit: function(e) {
e.preventDefault(); e.preventDefault();
var newSize = parseInt(this.el.find('input[name="displayCount"]').val()); var newSize = parseInt(this.el.find('input[name="size"]').val());
this.model.set({size: newSize}); var newOffset = parseInt(this.el.find('input[name="offset"]').val());
this.model.set({size: newSize, offset: newOffset});
}, },
render: function() { render: function() {
var tmplData = this.model.toJSON(); var tmplData = this.model.toJSON();