0
votes

I have one property grid...

Ext.create('Ext.grid.property.Grid', {
        id          : "PROPERTIES",
        autoHeight: true,
        width: 300,
        viewConfig : {
            forceFit: true,
            scrollOffset: 2 // the grid will never have scrollbars
        },
        listeners   :{
            propertychange:function(source,recordId,value,oldValue){
                alert(Ext.encode(source));
                alert(recordId);
                alert("new Value="+value);
            }
        },
        source  : {
            "title"         : "My Object",
            "color"         : Ext.Date.parse('10/15/2006', 'm/d/Y'),
            "Available"     : false,
            "Version"       : 0.01,
            "Description"   : "A test object"
        }
    });

My Query

When any values in the "source" changed, I need one listener to catch the changes. Suppose if user try to change the "title" from "My Object" to "Title1". How can I catch the new "title".

Note: In this grid I given one listeners "propertychange". But no effect!

Please help me to solve this. Thanks

1
Which version of Ext JS are you using? With Ext JS 4.2.1 your code works as you want, propertychange event is fired when you change any property: fiddle.sencha.com/#fiddle/3ctAkatum
Ext.create('Ext.button.Button',{ handler:function(){ Ext.getCmp("PROPERTIES").setSource({ "title": "Tikgh" }); }, text:"Change Source", renderTo:Ext.getBody() }); Please check this...Mohammed shafeek

1 Answers

1
votes

setSource method sets whole source data object containing the property data.

If you want to change only some property value you should use setProperty method which sets the value of a property and fire propertychange event:

Ext.create('Ext.button.Button', {
    handler: function() {
        Ext.getCmp("PROPERTIES").setProperty("title", "Tikgh");
    },
    text: "Change Source",
    renderTo: Ext.getBody()
});

Fiddle with live example: https://fiddle.sencha.com/#fiddle/3ct