Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Extended Javascript  - begginer

Posted on 2014-08-27
2
Medium Priority
?
197 Views
Last Modified: 2014-09-02
hi experts
I have this code

var submitHandler = function() {
	var ownrPnl = this.up('panel')[0], 
		tf      = this.ownerCt.query('#queryEditor')[0],
		query   = tf.getRawValue(),
		items;
		
	if (query.length < 1) {
		Ext.MessageBox.alert(
			'Error!', 
			'The query editor cannot be left blank!',
		 	function() {
				tf.el.frame('#F00');
				tf.focus();
			}
		);
		return;
	}	
	else {
		items = Ext.ComponentQuery.query(query);
	}	
		
	if (items.length < 1) {
		if (console.warn) {
			console.warn('No items found using:', query);
		}
	}
	else {
		if (console.info) {
			console.info('found ' + query.length + ' items using query: ', query);
		}
		Ext.each(items, function(item) {
			if (console.log) {
				console.log(item);
			}
			item.rendered &&  item.el.fadeOut().fadeIn();
			
		});
	}
};

var bottomToolbar = {
	xtype : 'toolbar',
	dock  : 'bottom',
	items : [
		'Ext.ComponentQuery.query(\'',
		{
			xtype  : 'textfield',
			itemId : 'queryEditor',
			flex   : 1
		},
		'\');',
		'->',
		{
			text    : 'Submit query',
			handler : submitHandler
		}
	]
	
};

Open in new window


I want to know what this code means
var ownrPnl = this.up('panel')[0],
            tf      = this.ownerCt.query('#queryEditor')[0],
            query   = tf.getRawValue(),
            items;
what is ownerCt ? and what is tf.el.frame('#F00'); ?
thanks
0
Comment
Question by:royjayd
2 Comments
 
LVL 22

Accepted Solution

by:
Ivo Stoykov earned 2000 total points
ID: 40289720
Hi

This is extJS library
> what is ownerCt ?
ownerCt : Ext.Container
This Component's owner Container (defaults to undefined, and is set automatically when this Component is added to a Container). Read-only.

> var ownrPnl = this.up('panel')[0],
Every component has an ownerCt property reference which is the Container or Component that holds the current Component. What the doc is saying is that .up() goes from ownerCt to ownerCt until 1) it finds a component that matches the parameter you passed, or 2) it gets to the topmost component in the hierarchy.

>tf      = this.ownerCt.query('#queryEditor')[0],
returns item with id=queryEditor - a EditorGrid Panel
> query   = tf.getRawValue(),

getRawValue( ) : String

Returns the raw String value of the field, without performing any normalization, conversion, or validation. Gets the current value of the input element if the field has been rendered, ignoring the value if it is the emptyText.

>and what is tf.el.frame('#F00');
this should be animation

generally it is a good idea to observe documentation

HTH
Ivo Stoykov
0
 

Author Comment

by:royjayd
ID: 40299314
Thanks,
any help with my next question will be greatly appreciated.
http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28510041.html

Thanks very much in advance.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question