• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Announcement

Collapse
No announcement yet.

[HELPED] Combo on toolbar will not reload after first success

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [HELPED] Combo on toolbar will not reload after first success

    I have two grids. I have a combo on the toolbar of second grid. I select a row from the first grid which send me to the second grid. All the data loads fine. I click the toolbar dropdown arrow on the toolbar second grid and it loads the values correctly. I complete the work on the second grid and go back to the first grid. I select another row on the first grid and go to the second grid.

    My problem: When I select the toolbar dropdown arrow on the second grid, the values are not loaded. Furthermore, the values are not reloaded on any subsequent attempts.

    I've debugged the back-end program and it is being called and the data is being correctly supplied when the arrow is clicked. I've tried autoLoad:false and any number of other "googled" solutions. My guess is it's something simple, but I cannot figure it out.

    Below is the code for the combo and the store. Any help would be appreciated.

    Code:
    xtype: 'combo',
    id: 'DYXXRNID2',
    fieldLabel: 'Run ID',
    displayField: 'STDESC',
    triggerAction: 'all',
    valueField: 'STDESC',
    editable: false,
    store: dsDropDown05,
    mode: 'remote',
    width: 200,
    selectOnFocus: true
    Code:
    var dsDropDown05 = new Ext.data.JsonStore({
        	autoLoad: true,
        	url: 'vvcall.pgm',
        	remoteSort: true,
        	root: 'DSROOT05',
        	fields: [	'DYXXRNID',
    			'DYXXRSBN',
    			'STDESC'		
    		],
        	listeners: {
        		beforeload: function() {
        			this.baseParams = {
        				pgm: 'XXGR206',
    					action: 'getDailyRuns',
    					limit: 35,
    					start: 0
        			};			
        		}
        	}
    });

  • #2
    Can you include the code that does the actions of loading the second grid and combo store?

    Comment


    • #3
      Here's the code.

      Code:
      //**********************************************************************************************************
      //***  Edit Window 2
      //**********************************************************************************************************
       	var fnDetailsGrid = function(strDYXXRNID,DYXXRSBN) 
      	{
      		var strIconCls = 'lorry_go';
      		var strDYXXRNID2 = currentRecord.get('DYXXRNID2');
      		var strDYXXRNID = currentRecord.get('DYXXRNID');
      		var strSTDESC= currentRecord.get('STDESC');
      		var strDYXXRSBN = currentRecord.get('DYXXRSBN');
      		var strDYXXDRVI = currentRecord.get('DYXXDRVI');
      		var strDYXXTRCI = currentRecord.get('DYXXTRCI');
      		var strDYXXTRLI = currentRecord.get('DYXXTRLI');
      		
      		
      		// update record in database
      		var updateRec = function(record) { 
      			Ext.Ajax.request({ 
      				url: 'vvcall.pgm', 
      				params: { 
      					pgm: 'XXGR206', 
      					action: 'moveOrders', 
      					DYXXRNID2: Ext.getCmp('DYXXRNID2').getValue(),
      					DYXXRNID: strDYXXRNID, 
      					DYXXRSBN: strDYXXRSBN, 
      					DYXXDRVI: strDYXXDRVI,
      					DYXXTRCI: strDYXXTRCI,
      					DYXXTRLI: strDYXXTRLI
      					
      				}, 
      				success: function(response) {
      					var check = response.responseText;
      					if (check) {
      						var data = Ext.util.JSON.decode(response.responseText);
      						if (data.SUCCESS=='1') {
      							record.commit();
      						} else {
      							vvShowError('ERROR OCCURED', 'Received a negative response from the server when attempting to update a record.');
      						}
      					} else {
      						vvShowError('ERROR OCCURED', 'Received a null response from the server when attempting to update a record.');
      					}
      				},
      				failure: function(){
      					vvShowError('ERROR OCCURED', 'Received a failure response from the server when attempting to update a record.');
      				}
      			});
      		};
      		
      		////////////////////////////////////////////////////////////////////////////////////////////
      	    // Process the saves / moves
      	    ////////////////////////////////////////////////////////////////////////////////////////////
      
      		var fnMoveProcess = function(){
      			
      		   Ext.Msg.confirm('Confirm Move of orders' 
      			 , 	'Are you sure you want to Move the selected orders?'  
      		    ,
      			   
      			function(btn, text) {
      				
      			   // if yes was pressed, then update selected records
      			  if (btn == 'yes') {
      				
      				  Ext.getBody().mask('<B>Moving Orders...<\/B>', 'x-msg-loading') ;
      				  Ext.getCmp('buttonMove').disable() ;
      				  
      				  //var sel = ccRelease.getSelections() ;
      				  var modifiedrecords = gridGrid02.getStore().getModifiedRecords();
      				  Ext.each (modifiedrecords,
      					 
      				  function(r) {
      					if (r.get('CCMOVE') == true)					
      					{
      						console.log(DYXXRNID2) ;
      						ggCCMOVE = r.get('CCMOVE'); 
      						updateRec(r) ;
      						countSelected = 0 ;
      						windowWindow02.hide();
      					}				 
      				  })
      				  
      				  dsStore01.reload();
      				  Ext.getBody().unmask();
      				  
      				}
      			});		
      		};	
      
      		// custom column plugin example
      		var ccMove = new Ext.grid.CheckColumn({
      		   header: "Move?",
      		   id: 'CCMOVE',
      		   dataIndex: 'CCMOVE',
      		   align: 'center',
      		   width: 50
      		});
      
      		// hide windowTruckDtl
      		var fnHideOrders = function() 
      		{
      			windowWindow02.hide();
      			countSelected = 0 ;
      			console.log('fnHideOrders-Cancel') ;
      		
      		};
      		// enable or disable button btnTruckDtlProcess 
      		var fnMoveBtnDtlProcess = function()
      			{
      			Ext.getCmp('buttonMove').disable();
      			dsStore02.each(function(r, rowIndex)
      				{
      				// at lease one check box must be seleted to enable process button
      				if (r.get('CCMOVE') == true) 
      					{
      					Ext.getCmp('buttonMove').enable();
      					};
      				});
      			};
      			
      		// the column model has information about grid columns
      		// dataIndex maps the column to the specific data field in
      		// the data store (created below)
      		var cmColumn02 = new Ext.grid.ColumnModel([{
      		header: "<b>Customer</b>",
      	  	sortable: false,
      	  	width: 175,
      	  	align: 'left',
      	  	dataIndex: 'OHNAME',
      		renderer: function(val, meta, record)
      		{
      		 return  record.data.OHNAME  +
      		 '</br><big>' + record.data.XXADR4 + '</big>' ;
      		} 
      
      	},  {
      	    header: "<b>Order</br>Number</b>",
      		sortable: false,
      		width: 75,
      		align: 'center',
      		dataIndex: 'SLORNO',
      		renderer: function(val, meta, record)
      		{
      		 return  '<big>' + record.data.SLORNO + '</big>' ;
      		} 
      	
      	},
      		ccMove
      		
      		]);
      //**********************************************************************************************************
      //***  Run Details Data Store
      //**********************************************************************************************************
      		var dsStore02 = new Ext.data.JsonStore({
      			autoLoad: true,
      			url: 'vvcall.pgm',
      			remoteSort: true,
      			root: 'DSROOT02',
      			totalProperty: "totalCount",
      			fields: ['DYXXRNID',
      					 'DYXXRSBN',					  
      					 'SLORNO',
      					 'OHNAME',
      					 'XXADR4'
      					  
      					],
      			listeners: { 
      				beforeload: function() { 
      					this.baseParams = { 
      						pgm: 'XXGR206', 
      						action: 'getRecs02', 
      						//action:'getDailyRuns',
      						DYXXRNID:strDYXXRNID, 
      						DYXXRSBN:strDYXXRSBN, 
      						limit: 125, 
      						start: 0 
      					};
      				},
      				load: function() 
      					{
      	                fnMoveBtnDtlProcess();
      				}
      			}
      		}); 	
      //**********************************************************************************************************
      //***  Available Runs Data Store for Dropdown
      //**********************************************************************************************************
      
      	var dsDropDown05 = new Ext.data.JsonStore({
          	autoLoad: false,
          	url: 'vvcall.pgm',
          	remoteSort: true,
          	root: 'DSROOT05',
          	//totalProperty: "totalCount",
          	fields: [	'DYXXRNID',
      					'DYXXRSBN',
      			     	'STDESC'		
      				],
          	listeners: {
          		beforeload: function() {
          			this.baseParams = {
          				pgm: 'XXGR206',
      					action: 'getDailyRuns',
      					limit: 35,
      					start: 0
          			};	
      				
          		}
          	}
          });
      
      //**********************************************************************************************************
      // Run Details Grid
      //**********************************************************************************************************
      		var gridGrid02 = new Ext.grid.EditorGridPanel({ 
      			region: 'center', 
      			stripeRows: true,
      			autoScroll: true, 
      			title: 'Run Details', 
      			width:400, 
      			height:400, 
      			header: false, 
      			loadMask: true, 
      			store: dsStore02, 
      			cm: cmColumn02, 
      			frame:true, 
      			plugins:ccMove, 
      			tbar: [
      			
      			{
      			xtype: 'button',
      			id: 'buttonMove',
      			text: 'Move',
      			//disabled: true,
      			iconCls: 'save',
      			handler: fnMoveProcess
      			},'-',{
      			id: 'btnOrderCancel',
      			xtype: 'tbbutton',
      			text: 'Cancel',
      			tooltip: 'cancel',
      			iconCls: 'cancel',
      			handler: fnHideOrders
      			}, {
      			xtype: 'tbspacer',
      			width: 10
      		}, {
      			xtype: 'tbtext',
      			text: 'Move to Run'
      		}, {
      			xtype: 'combo',
          		id: 'DYXXRNID2',
          		fieldLabel: 'Run ID',
      			displayField: 'STDESC',
      			triggerAction: 'all',
      			valueField: 'STDESC',
      			editable: false,
      			store: dsDropDown05,
      			mode: 'remote',
          		width: 200,
          		selectOnFocus: true
      			}]
      		}); 
      
      		gridGrid02.on('afterEdit', function(e) {
      			var strGrid = e.grid;
      			var recRecord = e.record;
      			var strField = e.field;
      			var strValue = e.value;
      			var strOValue = e.originalValue;
      			var strRow = e.row;
      			var strColumn = e.column;
      			fnMoveBtnDtlProcess() ;
      			
      		});
      		
      		var north02 = new Ext.Panel
      		({
      		frame: true,
      		region: 'north',
      		html: '<table border="0" style="font-family:helvetica,tahoma,verdana,sans-serif;font-size:16px;font-weight:bold;margin-left:10px;"><tr><td><br>' +
      		  'Run: &nbsp' + strSTDESC   
      		+ '&nbsp &nbsp &nbsp &nbsp' + strDYXXRNID + '</br>' 
      		+ 'Run Sub: &nbsp &nbsp &nbsp' + strDYXXRSBN 
      		//+ '&nbsp &nbsp &nbsp &nbsp &nbsp Weight: &nbsp &nbsp' + strWeight 
      		//+ '&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp' 
      		//+ 'Total List: &nbsp &nbsp' + CurrencyFormatted(strList) 
      		+ '<br> </br>' 
      		+ '</td></tr>' 
      		});
      
      		var windowWindow02 = new Ext.Window
      		({
      		closeAction: 'hide',
      		iconCls: strIconCls,
      		height: 750,
      		width: 450,
      		x:400,
      		y:0,
      		items: [gridGrid02, north02],
      		border: false,
      		title: 'Run Details',
      		layout: 'border',
      		keys:	[{
      			key: Ext.EventObject.ENTER,
      				fn: function(){}
      				}, {
      			key: Ext.EventObject.ESC,
      			fn: fnHideOrders
      				}]
      		});
      	
      		Ext.getBody().mask();
      		windowWindow02.show();
      
      		// set show listener on window (we set this for window positioning after render so that window does not flash at startup)
      		windowWindow02.on("show", function() 
      		{
      		
      		});
      
      		// set hide listener on window
      		windowWindow02.on("hide", function() 
      		{
      			Ext.getBody().unmask();
      			dsStore01.reload();
      		});			
          }; 
      //**********************************************************************************************************
      //***  End of Edit Window 2
      //**********************************************************************************************************

      Comment


      • #4
        I glanced at your code and don't see where it would be doing the actions you described in your initial post. I don't see where you are loading dsdropdown05...
        Last edited by sean.lanktree; 05-23-2013, 03:49 PM.

        Comment


        • #5
          Near the very bottom windowWindow02.show();

          Comment


          • #6
            I believe the answer is that the Store is only loaded when the dropdown list is first displayed. There may be a possibility of overriding the triggerAction, but I'm not experienced enough with ExtJS to do that.

            In any case, you can close this as I'm going to try another solution.

            Comment


            • #7
              If you want, you can add a 'beforeshow' event on the window, and load the store then. Or explicitly load the store before calling windowWindow02.show()

              Comment


              • #8
                Thanks. I'll try that.

                Comment

                Working...
                X