that.currentRecordId = function() { return m_currentRecordId; };
that.currentRecordData = function() { return m_currentRecordData; };
that.filters = function() { return m_filterSet; };
+ that.gotRecords = function() { return m_gotRecords; };
// Accessor methods for individual widgets: writers
that.set_sortOrder = function(val) { m_sortOrder = val };
log("record");
// FIXME: record is async!!
clearTimeout(m_paz.recordTimer);
+ queue("record").publish(data);
var detRecordDiv = findnode(recordDetailsId(data.recid[0]));
if (detRecordDiv.length) {
// in case on_show was faster to redraw element
m_paz.search(m_query, m_perpage, m_sortOrder, pp2filter, undefined, params);
}
+ // fetch record details to be retrieved from the record queue
+ that.fetchDetails = function(recId) {
+ log("fetchDetails() requesting record '" + recId + "'");
+ m_paz.record(recId);
+ };
+
// switching view between targets and records
function switchView(view) {
});
});
+mkws.registerWidgetType('Details', function() {
+ var that = this;
+ var recid = that.node.attr("data-mkws-recid");
+ if (this.team.gotRecords()) {
+ that.team.fetchDetails(recid);
+ } else {
+ this.team.queue("firstrecords").subscribe(function() {
+ that.team.fetchDetails(recid);
+ });
+ }
+ this.team.queue("record").subscribe(function(data) {
+ console.log(data);
+ if ($.inArray(recid, data.recid) > -1) {
+ var template = that.team.loadTemplate(that.config.template || "Record");
+ that.node.html(template(data));
+ }
+ });
+ that.autosearch();
+});
mkws.registerWidgetType('Records', function() {
var that = this;