/**
* Extjs3.4常用基础方法使用
*/
Ext.onReady(function(){
/*var colorsArray=new Array();
colorsArray[0]='Blue';
colorsArray[1]='Red';
colorsArray[2]='White';
var colorsArrayType=Ext.type(colorsArray);
// colorsArrayType’s value is “array”.
document.writeln(colorsArrayType);
var isArray=Ext.isArray(colorsArray);
//isArray is true
document.writeln(isArray);
//position is 2, the index of 'White' in the array.
var position=colorsArray.indexOf('White');
document.write(position+"<br>");
// 'Brown' does not exist in the array,
// position is -1. 不存在返回-1,存在返回索引值
position=colorsArray.indexOf('Brown');
document.write(position+"<br>");
//remove one from a array
colorsArray.remove('Blue');
position=colorsArray.indexOf('Blue');
// 'Blue' does not exist anymore,
// position is -1.
document.write(position+"<br>");
var colorsObject={color1:'Blue',color2:'Red',color3: 'White'};
var colorsObjectType=Ext.type(colorsObject);
document.write(colorsObjectType);//colorsObjectType's value is "Ojbect"
var aNumber=1;
var aString='1';
//Ext.num:验证某个值是否数字的一个辅助方法,若不是,返回指定的缺省值
// number is 1.
var number=Ext.num(aNumber,0);
document.write(number);
//不是数字,返回指定默认值
number=Ext.num(aString,0);
document.writeln(number);
//converting empty references to a default value;
//验证值是否非空、非null、非undefined、非空白字符的便捷方法
var empty;
var notEmpty=Ext.value(empty,'defaultValue',false);
//// notEmpty is 'defaultValue'
document.writeln(notEmpty);
var sample;
var defined=Ext.util.Format.undef(sample+'define is an empty string<br/>');
document.write(defined);
// defined is now "sample is now defined".
sample = "sample is now defined";
defined = Ext.util.Format.undef(sample);
document.write(defined + '<br/>');*/
/*
var needsEscape = "ExtJS's String Class will escape this";
//escape方法对‘进行转移为\'
var escaped = String.escape(needsEscape);
document.write(escaped+'<br>');
var sort='ASC';
sort=sort.toggle('ASC','DESC');
document.write(sort);
var sample = "some text";
var converted=Ext.util.Format.uppercase(sample);
// converted is now "SOME TEXT".
document.write(converted+'<br>');
sample = "SOME TEXT";
converted=Ext.util.Format.lowercase(sample);
document.write(converted+'<br>');*/
var number1 = 20;
var number2 = 72;
//constrain输出在木个范围的值,就输出最小值或最大值
var constrained = number1.constrain(25, 50);
document.write(constrained+"<br>");
var constraineds = number2.constrain(25, 50);
document.write(constraineds+"<br>");
}
);