Kamis, 05 Juni 2014

EXTJS Static Combobox

Sometimes you don't want to make a separate store and modal in your code. A lot of file make you hard to maintain your application. Especially the combobox and the store just shows once in your application. So, you just need a static combobox. Here it is the code;

Altirenative 1;
{
    xtype:'combo',
    fieldLabel:'Field Label',
    name:'theName',
    queryMode:'local',
    store:['1','2'],
    displayField:'Display Field',
    autoSelect:true,
    forceSelection:true
 }

Alternative 2:
// The data store containing the list of states
var pilihan = Ext.create('Ext.data.Store', {
    fields:['display','value'],
    data :[
        {
            "display":"Ya",
            "value":"1"
        },
        {
            "display":"Tidak",
            "value":"0"
    }]
});

// Create the combo box, attached to the states data store
Ext.create('Ext.form.ComboBox',{ 
    fieldLabel:'Pilih', 
    store: pilihan, 
    queryMode:'local', 
    displayField:'display',
    valueField:'value', 
    renderTo:Ext.getBody()
});

Alternative 3:
{
    xtype:'combo',
    fieldLabel:'Main',
    name:'main',
    queryMode:'local',
    anchor: '100%',
    store: Ext.create('Ext.data.Store', {
        fields: ['value', 'display'],
        data: [
            {
                "display": "Ya",
                "value": 1
            },
            {
                "display": "Tidak",
                "value": 0
            }
        ]
    }),
    displayField:'display',
    valueField: 'value',
    autoSelect:true,
    forceSelection:true
 }

Tidak ada komentar:

Posting Komentar

Backup Semua Database PostgreSQL dalam Container

Langkah 1: Identifikasi Container PostgreSQL Gunakan perintah docker ps untuk menemukan container PostgreSQL: docker ps Cata...