Results 1 to 3 of 3
  1.    #1  
    After displaying a list, I want to update the data in the list and refresh the screen. I have the following code:

    Code:
    	listAttributes = {
    		itemTemplate: 'main/search-result',
    		listTemplate: 'main/result-list',
    	};
    	this.model = {
    		items: [
    		        {recnum: 2, myString: "Joe"},
    			{recnum: 3, myString: "David"},
    		]
    	};
    	this.controller.setupWidget('results-list', listAttributes, this.model);
    	this.controller.modelChanged(this.model, this);
    I don't get any errors but nothing changes on the screen. What am I doing wrong?
  2. BryanRoth's Avatar
    Posts
    26 Posts
    Global Posts
    29 Global Posts
    #2  
    Code:
            listAttributes = {
    		itemTemplate: 'main/search-result',
    		listTemplate: 'main/result-list',
    	};
    	this.model = {
    		items: [
    		        {recnum: 2, myString: "Joe"},
    			{recnum: 3, myString: "David"},
    		]
    	};
    	this.controller.setupWidget('results-list', listAttributes, this.model);
    	this.controller.modelChanged(this.model, this);
    Do you have this code located in the setup function? If it's in setup, you don't need to call modelChanged. Call modelChanged after you perform an action that requires the list to be refreshed.
  3.    #3  
    No, I have this code in a function that gets called after an AJAX success. In the setup function, I display some names, then I'm trying to change the list after the AJAX call. I know I'm missing something but I can't figure it out.

Posting Permissions