Cant get Widget Tutorial to work

2
I've been having a look at the tutorials for building your own widgets here and having problems getting the first part of the QuickSearch widget to work. Here is the js I'm using: dojo.provide("QuickSearch.widget.QuickSearch"); mendix.widget.declare("QuickSearch.widget.QuickSearch", { addons : [ dijit._Templated, dijit._Contained ], inputargs: { searchEntity : '', searchAttribute : '' }, /* localized strings */ txtSearch : " Find ", txtNothingFound : "Nothing found", templatePath : dojo.moduleUrl('QuickSearch') + "widget/templates/QuickSearch.html", postCreate : function() { this.actSetupSearchBar(); this.actRendered(); }, actSetupSearchBar : function() { this.buttonNode.value = this.txtSearch; this.connect(this.buttonNode, "onclick", dojo.hitch(this, this.getUsers)); }, getUsers : function() { var inputString = mx.parser.escapeQuotesInString(this.inputNode.value); var xPathConstraint = "[contains(" + this.searchAttribute + ", '" + inputString + "')]" mx.processor.getObjectsByXPath("//" + this.searchEntity + xPathConstraint, {}, dojo.hitch(this, this.showResults)); }, showResults : function(objArray) { dojo.empty(this.listNode); for(var i = 0; i < objArray.length; i++) { var object = objArray[i]; var attribute = object.getAttribute(); this.listNode.appendChild(mendix.dom.li(attribute)); } }, uninitialize : function(){ } }); At first the widget did not even set the label for the button defined in actSetupSearchBar, so I added this line to the postCreate function as shown in the code above. this.actSetupSearchBar(); This is not shown in the tutorial and I don't know if it is correct, but it at least sets the button label. However, I get no output from the widget. I am using 2.5.0.1 - has something changed with this version that makes getUsers return no data, or can anyone see where the problem is. Thanks
asked
1 answers
2

Found it...

This line in showResults was wrong

    var attribute = object.getAttribute(this.searchAttribute);

It still looks to me like the tutorial should be amended to include the actSetupSearchBar call in the postCreate function

answered