RapidApp

 view release on metacpan or  search on metacpan

share/assets/js/510-AppDV.js  view on Meta::CPAN

Ext.ns('Ext.ux.RapidApp.AppDV');


Ext.ux.RapidApp.AppDV.DataView = Ext.extend(Ext.DataView, {
	
  // New option to enable all links (<a> tags)to be processed. This is not the default
  // because this can result is navigating away from the interface which is
  // usually not desired. Links with explicit target attributes (i.e. target="_blank")
  // are already handled, and relative links are also already handled. The main
  // reason for this setting and the fact that it is false by default is due both
  // to back-compat, and also the fact that the native Ext.DataView code does not allow
  // links through by default when singleSelect or multiSelect is on
  allow_all_links: false,
  
	// TODO: make cascade recursive like in Ext.Container
	cascade: function(fn,scope,args) {
		fn.apply(scope || this, args || [this]);
		return this;
	},
	
  // collectData() is called whenever rendering/refreshing the template:
  collectData: function() {
    // New: Save the latest response data within the XTemplate object via the
    // reference keys which are now made available via DataStorePlus. This
    // enables the template environment to get this data via '[{this.resData}]'
    try{
      var hashval = window.location.hash;
      if(hashval && hashval.search('#') == 0) { 
        hashval = hashval.substring(1); 
      }
      this.tpl.hashval = hashval;
      this.tpl.resData = this.store.lastJsonData
        // The lastJsonData might not be populated on the first load, for this 
        // case,   // reach into the lastResponse, which is also now tracked, and decode it
        || Ext.decode(this.store.proxy.lastResponse.responseText);
    }catch(err){};
    return Ext.ux.RapidApp.AppDV.DataView.superclass.collectData.apply(this,arguments);
  },
  
  getLoadMaskEl: function() {
    var El = this.getEl();
    return El ? El.parent().parent() : Ext.getBody();
  },
  
	initComponent: function(){
		Ext.each(this.items,function(item) {
			item.ownerCt = this;
		},this);
		Ext.ux.RapidApp.AppDV.DataView.superclass.initComponent.call(this);
		this.components = [];
    
    this.on('beforeclick',this.onBeforeclick,this);
		this.on('click',this.click_controller,this);
		
    this.on('containerclick',function(dv,event){
      // Block the containerclick, which clears selections, for the special 
      // AppDV-specific clickable command (i.e. store buttons, etc)
      if(this.find_clickableEl(event)){ return false; };
    },this);
    
    this.tpl.store = this.store;
    
		//if(!this.store) { this.store = this.ownerCt.store; }
		
		this.store.on('beforesave',this.onBeforesave,this);
		this.store.on('beforeremove',this.onBeforeremove,this);
		
		// Special AppDV override: addNotAllowed based on
		// current edit record:
		var cmp = this;
		cmp.on('afterrender',function(){
      this.el.on('click',this.el_click_controller,this);
 
			cmp.store.addNotAllowed = function(){
				if(cmp.currentEditRecord && cmp.currentEditRecord.editing) {
					return true;



( run in 2.417 seconds using v1.01-cache-2.11-cpan-97f6503c9c8 )