We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8386 ☆ A M B ☆
    • 160 Posts
    I am currently working on a custom CMP and in the grid layout when I select to edit an particular item, MODx seem to only send 1 request for a combo-box of a related table. I am using PageSize with the combo-box to load a limited amount of data at a time.

    The problem I am having is that if the related data that I need form the combo-box doesn't exist in the first set of data that was loaded, I get the id showing up in the combo-box instead, I have tried making a request for new combo-box on each edit but then the window doesn't update even though I can see that the store has updated.

    updateRelease: function(btn,e) {
    	if (!this.updateReleaseWindow) {
    		this.updateReleaseWindow = MODx.load({
    			xtype: 'releases-window-release-update'
    			,id: 'releases-window-release-update'
    			,record: this.menu.record
    			,listeners: {
    				'success': {fn:this.refresh,scope:this}
    			}
    		});
    	}
    
    	var comboBox = Ext.getCmp('releases-combo-artists');
    	comboBox.store.reload({
    		params: { id: this.menu.record.artist }
    	});
    
    	this.updateReleaseWindow.setValues(this.menu.record);
    	this.updateReleaseWindow.show(e.target);
    }
    
      • 8386 ☆ A M B ☆
      • 160 Posts
      After investigation more, this seem to be a issue with the pagination on pagesize in ext, I have tested some of the core MODx modules like the policy combo by changing it to 2 and trying to edit one that wouldn't be available on the first set of results and it worked until I clicked the combo-box and not select anything then try to edit again to see that its showing the id rather than the name of the item.
        • 18373 ☆ A M B ☆
        • 3,141 Posts
        Can you post your processor?

        Line 13-16 in your posted ExtJS is moot, it already sends an "id" param by default if there is a value set (which is what your record config or setValues method does).

        Just make sure that the specific object is included in the response. This is one way: https://github.com/Mark-H/bdListings/blob/master/core/components/bdlistings/processors/mgr/category/getcombo.php#L13
          Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

          Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
          • 8386 ☆ A M B ☆
          • 160 Posts
          Hey Mark, this is not entirely true about Line 13-16 since this only happens once. Because the window is only hidden and then shown again when the user clicks update. The only transaction that would happen is the Values being set. Even with my processor having the id in there the problem persists.

          Using my method above I get it to deliver back the right related item but the actual field won't update since its already rendered.

          I have tested this in the MODx core itself and noticed it has the same issue. Just open your modx.combo.js and edit the Policy combo PageSize to 2. You will get the issue I am having at that point.