Ext.onready (function () {/* * ext.apply (src,apply) and Ext.applyif (Src,apply) Two methods use and difference comparison *///ext.apply (src,apply) method to extend and modify the properties or methods of an existing object//define object Srcvar src = {name: "Tom", age:22};//definition object Applyvar apply= {sex: "Male", Age:33,name: "Jack", Sal : 10000};//uses the Ext.apply method to attribute or extend the Src object ext.apply (src,apply),////view src properties and attribute values for (var attr in src) { document.write (attr + "--" +src[attr]) document.write ("<br>")}//results as follows//name--jack//age--33//sex--man// sal--10000//from the source code and test results can be seen://With the properties in the Apply object and the SRC object in the attribute to be compared one by one, if there is no attribute in src to copy the assignment to SRC, if there is the same attribute, the value of the original property is overwritten// The result of the Ext.apply method extension is the test results above for the//*************** divider line ***********************document.write ("<br>")// The difference between ext.applyif (src,apply) and ext.apply (src,apply) is that if there is a property currently being compared in the original object, then it will not be copied, and the value of the property will of course not be modified//For example: var srcif = { Name: "Tom", Age:22};var applyif= {sex: "Male", Age:33,name: "Jack", sal:10000}; Ext.applyif (Srcif,applyif); for (Var attr in Srcif) {document.write (attr+ "----" +srcif[attr]) document.write ("<br > ")}//result is//name----tom//age----22//sex----male//sal----10000})
extjs--13--ext.apply (src,apply) and Ext.applyif (Src,apply) Two methods of use and difference comparison