Commit eeb26a2f authored by Sven Franck's avatar Sven Franck

added portal_type to query for total number of records

parent f428d904
......@@ -2023,15 +2023,20 @@
if (config.columns && config.columns.length > 0) {
obj.select_list = config.columns;
}
if (config.limit) {
obj.start = config.limit[0];
obj.items = config.limit[1];
}
if (item) {
obj.query += 'AND (id:"%' + item + '")';
obj.start = 0;
obj.items = 1;
}
if (obj.start !== undefined) {
obj.limit = [obj.start, obj.items];
} else {
obj.start = config.limit[0];
obj.items = config.limit[1];
obj.limit = [];
}
obj.limit = [obj.start, obj.items];
if (config.wildcard) {
obj.wildcard_character = config.wildcard
} else {
......@@ -2571,6 +2576,7 @@
// generate content
// NOTE: this may include local header/footer/panel/popups
// TODO: beware of target when adding the above! should not be content
// TODO: bundle into a single DOM operation!
for (i = 0; i < gadgets.length; i += 1) {
gadget = gadgets[i];
gadget_id = gadget.gadget || gadget.getAttribute("data-gadget-id");
......@@ -2612,8 +2618,12 @@
return undefined;
})
.then(function(sample_data) {
if (sample_data && typeof sample_data.target.response === "string") {
response = JSON.parse(sample_data.target.response);
if (sample_data) {
if (typeof sample_data.target.response === "string") {
response = JSON.parse(sample_data.target.response);
} else {
response = sample_data.target.response;
}
return init.storeSampleData(response, portal_type, "items");
}
return undefined;
......@@ -2634,7 +2644,7 @@
gadget_type = gadget.type ||
gadget.getAttribute("data-gadget-type");
constructor = gadget_type;
query = {};
query = init.buildQuery({}, portal_type);
}
return util.fetchData("items", query);
})
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment