Skip to content

Instantly share code, notes, and snippets.

@flexd

flexd/index.js Secret

Last active January 2, 2016 02:19
Show Gist options
  • Save flexd/357b24bb20308e247dbf to your computer and use it in GitHub Desktop.
Save flexd/357b24bb20308e247dbf to your computer and use it in GitHub Desktop.
var loadQueue = function (filters, callback) {
$.getJSON("<hostname>", {"q": JSON.stringify({"filters": filters})}, function (response) {
var queueList = response.objects;
var queueSize = response.num_results;
callback(queueList, queueSize);
});
};
function updateProcessing(processing, size) {
var in_processing_update = $("#in_processing").dynatable().data('dynatable');
console.log("in_processing_update: " + in_processing_update); // THIS RETURNS NULL
//in_processing.settings.dataset.records = processing;
//in_processing.process();
//console.log(in_processing.settings)
setTimeout(getProcessing, 1*1000);
};
function getProcessing() {
var filters = [{"name": "processing", "op": "eq", "val": 1}];
loadQueue(filters, updateProcessing);
}
function processing_trWriter(rowIndex, record, columns, cellWriter) {
if (rowIndex > 5) return false;
return "<tr><td>" + record.first_name + " " + record.last_name + "</td></tr>";
}
$(document).ready(function () {
var in_processing_init = $("#in_processing").dynatable({
features: {
paginate: false,
sort: false,
search: false,
recordCount: false,
perPageSelect: false,
},
dataset: {
records: []
},
writers: {
_rowWriter: processing_trWriter
}
}).data('dynatable');
console.log("in_processing_init: " + in_processing_init); // This returns null.
getProcessing();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment