RSS

Category Archives: Ext JS

ExtJs Ajax Pass Parameter as Array

Sometimes we need to pass multiple values for one parameter in ajax, that is pass an array as parameter, in ext js we can acheive this as,

params:{

param1: ‘value’,

param2: [‘value1′,’value2’,…],

}

Here param2 has an array of values….

 
1 Comment

Posted by on August 1, 2011 in Ext JS

 

Tags: , , , , , ,

Querying in ExtJs Json Store

This deals with queries similar to sql like getting number of records from a json store based on conditions, getting a record etc,

Ex: To get the no of records with title “xxx” from the below json data store,

var dataList = {
    “data”: [{
            “id”: 1,            
        “title”:”xxx”,                
            },
        {
            “id”: 2,            
        “title”:”yyy”        
            }]
};

var sampleStore = new Ext.data.JsonStore({
                id: ‘sampleStore’,
                ..

                data:dataList,
                ..
            });

Use this,

sampleStore.query(“title”, “xxx”)).getCount()

 

To get the record by id,

sampleStore.getById(id)

 

To get the record at particular index,

sampleStore.getAt(index)

 

 
2 Comments

Posted by on July 22, 2011 in Ext JS

 

Tags: , , ,

Set width for options in ExtJs Combo

While creating a new extjs combo with

new Ext.form.ComboBox({
x: 0,
store:………….

If you want to explicitly set the width of the combo drop down to match the width of input box, specify

matchFieldWidth: true,

To explicitly specify the width, use

minListWidth:100  – if you want to set as 100px

 

 

 
3 Comments

Posted by on July 22, 2011 in Ext JS

 

Tags: , , , ,