desc => 'Ranged distribution formulas, fleshed with entries',
params => [
{desc => 'Authentication token', type => 'string'},
+ {desc => "offset", type => "number"},
+ {desc => "limit", type => "number"}
],
return => {desc => 'List of distribution formulas'}
}
);
sub ranged_distrib_formulas {
- my($self, $conn, $auth, $org) = @_;
+ my ($self, $conn, $auth, $offset, $limit) = @_;
+
+ $offset ||= 0;
+ $limit ||= 10;
+
my $e = new_editor(authtoken=>$auth);
return $e->event unless $e->checkauth;
my $orgs = $U->user_has_work_perm_at($e, 'CREATE_PICKLIST', {descendants =>1});
{
flesh => 1,
flesh_fields => {acqdf => ['entries']},
- order_by => {acqdfe => ['position']}
+ order_by => {acqdf => "name"},
+ limit => $limit,
+ offset => $offset
}
- ]);
+ ]) or return $e->die_event;
for (@$forms) {
var localeStrings = dojo.i18n.getLocalization('openils.conify', 'conify');
-var formCache = [];
+var formCache = {};
var formula, entryTbody, entryTemplate, dndSource;
var virtualId = -1;
var pcrud;
+function gridDataLoader() {
+ fListGrid.resetStore();
+ fListGrid.showLoadProgressIndicator();
+ fieldmapper.standardRequest(
+ ["open-ils.acq", "open-ils.acq.distribution_formula.ranged.retrieve"], {
+ "async": true,
+ "params": [
+ openils.User.authtoken,
+ fListGrid.displayOffset,
+ fListGrid.displayLimit
+ ],
+ "onresponse": function(r) {
+ var form = openils.Util.readResponse(r);
+ formCache[form.id()] = form;
+ fListGrid.store.newItem(form.toStoreItem());
+ },
+ "oncomplete": function() {
+ fListGrid.hideLoadProgressIndicator();
+ }
+ }
+ );
+}
+
function draw() {
pcrud = new openils.PermaCrud();
location.href = location.href + '/' + fmObject.id();
}
- fieldmapper.standardRequest(
- ['open-ils.acq', 'open-ils.acq.distribution_formula.ranged.retrieve'],
- { async: true,
- params: [openils.User.authtoken],
- onresponse: function (r) {
- var form = openils.Util.readResponse(r);
- formCache[form.id()] = form;
- fListGrid.store.newItem(form.toStoreItem());
- },
- oncomplete: function() {
- fListGrid.hideLoadProgressIndicator();
- }
- }
- );
-
+ fListGrid.dataLoader = gridDataLoader;
+ gridDataLoader();
}
}