+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) {
+ if ($.inArray(recid, data.recid) > -1) {
+ var template = that.team.loadTemplate(that.config.template || "details");
+ that.node.html(template(data));
+ }
+ });
+});