Extjs + jQuery juntos

¿Cómo se utiliza? Ext.onReady function and jQuery together ?

I have used ext js for generating tree and I want to use jQuery for validation of some textfield values.

Or any other way to validate textfield using extjs?

preguntado el 27 de agosto de 11 a las 18:08

4 Respuestas

Al Ext.onReady is similar to jQuery's ready handler, they both fire when DOM becomes ready. This means you can call the jQuery handler normally at a separate line eg:

$(function(){
 // your code...
});

Respondido 27 ago 11, 22:08

It would be just fine to use the jQuery $ function from within Ext.onReady as well. - andrewle

@andrewle: True, I would prefer keeping jQuery code at its own place though :) - Sarfraz

Totally agree. Just mentioning that it's possible since people often think you can't program across libraries. - andrewle

Just declare their libraries on top and write their initialilzations on separate lines like below

$(document).ready(function(){   // jquery ready call
      // some code here
 });  

y

Ext.onReady(function(){
   /// some code here
});

contestado el 28 de mayo de 12 a las 11:05

Puede que quieras ver Ext.onReady() vs $(document).ready() for an answer showing how to load both libraries alongside each other.

contestado el 23 de mayo de 17 a las 15:05

Ext has built-in validation via textfield configs for some things (e.g. allowBlank: false) and validator functions for others (all of the VTypes functions), and also hooks for providing custom validation. Not sure why you'd need to add jQuery just for that, maybe you can be more specific?

But assuming you really do need to use both, you should be able to use either Ext's or jQuery's DOM ready function as your entry point (not both), and then write whatever code you need inside of it assuming both libraries are properly referenced and initialized. Assuming that each library's DOM ready function works as advertised, the DOM should be available when either one is called, which is the only point of using those methods anyway. Since you are using Ext widgets I would probably stick with Ext.onReady just to be on the safe side, but in theory it really shouldn't matter which function you use.

Respondido 28 ago 11, 08:08

can u give some script,how to write jquery inside Ext.onReady()?because when i include jquery.js file then Ext.onReady function is not working. - user915755

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.