Friday, April 20, 2012

ExtJS4: get values from ExtJS form

Use the form.getValues() Method:

var  myFormPanelObj  = Ext.getCmp("myFormPanelId");
var data  =   myFormPanelObj.getForm().getValues();  
console.log("data: " + Ext.JSON.encode(data)); // {field1name : "field1value" , field2name : "field2value"}

References:
http://www.sencha.com/forum/showthread.php?62958-ExtJs-Jquery-form-submit

Thursday, April 19, 2012

Spring 3.0 - Ajax Handling Example

Finally I found a Simple and Fully functional sample of a proyect ussing the spring framework and the Ajax Technology. It's a Netbeans Project. There is the explained code and you can download the project sources.

http://cmop17.wordpress.com/2010/12/17/spring-usando-ajax-con-jquery-post-and-get/


Wednesday, March 14, 2012

ExtJS 4: Uncaught Ext.Error: Ext.Loader is not enabled, so dependencies cannot be resolved dynamically. Missing required class:

if you get the error:

Uncaught Ext.Error: Ext.Loader is not enabled, so dependencies cannot be resolved dynamically. Missing required class: SIBismark.view.Viewport


Add the following line at the beginning of your js file

Ext.Loader.setConfig({enabled:true});


In Example in the app.js :



Ext.Loader.setConfig({enabled:true});
Ext.application({
    name: 'SI'
    ,requires:['SI.view.Viewport']
    ,autoCreateViewport: true
    ,launch: function() {        
        // This is fired as soon as the page is ready
    }
}); 


Reference:
http://www.sencha.com/learn/architecting-your-app-in-ext-js-4-part-3/

Tuesday, March 6, 2012

Configuring Netbeans Java Project with IBM WebSphere MQ Libs

1. Download and Install IBM MQ (http://www-01.ibm.com/software/integration/wmq/)
In NetBeans,
2. Create a Java Application Project.
3. go to Tools > Librarias option
4. Create a new Library
5. Click the "Add Jar/Folder" Button and select all the jars present in the route: mq_installation_dir\java\lib
6. Click "ok" button
7. Go to YourProject > Libraries, right click and "Add Library"
8. Select the library that you have just created
9. Click the  "Add Library" button

Saturday, February 4, 2012

Java: Exception in thread main java.lang.NoClassDefFoundError

Try doing the following steps:

1. Set the CLASSPATH to the location of the folder where you have saved the .java files.
2. Make sure that in the PATH, you got a setting describing where the installation files are- i.e C:\Program Files\javajdk 1.6.0_18\bin.
3. Create/Verify a variable called JAVA_HOME containing the location for the jdk bin. I.E C:\Program Files\javajdk 1.6.0_18

Note: Be aware of close an reopen the console to load the changes of your path

Reference:
http://www.tech-recipes.com/rx/826/java-exception-in-thread-main-javalangnoclassdeffounderror/

Tuesday, January 3, 2012

Javascript: create a java-like static class

A static class is one you can never create a new instance of. For example, instead of having static methods in a JavaScript class, you can create a static class by declaring your functions as variables on a pure JavaScript Object. This method can be used for example for creating a class of utility functions:



var utils = {
 trim:function(str, numCharacters){
  return str.substring(0, numCharacters);
 },

 log:function(msg){
  if(console){
   console.log(msg);
  }
 }
}
var s = utils.trim("Good day to you sir", 4);
 
Source:
http://www.arpitonline.com/blog/2009/07/24/object-oriented-javascript-techniques/

ExtJS 4: get array data from store

var arrayData = Ext.pluck(store.data.items, 'data');
//arrayData = [ ["1", "value1"] , ["2","value2"] ]
 
Reference:
http://stackoverflow.com/questions/2526764/how-to-retrieve-json-data-array-from-extjs-store