PDA

View Full Version : How to tell the value has been updated in PropertyGrid



gangxu
19 Feb 2009, 8:16 PM
How can I tell the values in PropertyGrid have been updated?

My propertyGrid is loaded in my code like this:

var rec = new Grid.PropertyRecord({
name: 'abc',
value: '123'
});
propertyPanel.store.add(rec);

After I change the value, both propertyPanel.store.getAt(0).dirty and propertyPanel.store.isModified('abc') still returns false.

I added propertyPanel.store.commitChanges(); before I query dirty and isModified. Still returns false here.

Is there an easy way to tell the value has been modified? Or do I use PropertyPanel wrong?

TIA!
Gang

mjlecomte
20 Feb 2009, 3:55 AM
Post some code that makes sense. What is propertyPanel?

Post a working showcase

http://extjs.com/learn/Ext_Forum_Help#Posting_a_working_showcase

gangxu
20 Feb 2009, 7:52 AM
Sorry, I really mean PropertyGrid, not PropertyPanel. Newbie here.

Here is a simple code I have here.

mjlecomte
20 Feb 2009, 8:58 AM
Just paste the code inside code tags please, don't attach.

gangxu
20 Feb 2009, 9:51 AM
Here it is. Sorry about it.

The code shows how the PropertyGrid is populated. When the values are updated, is there an easy way to tell?



<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title id='title'>Title</title>

<!-- ** CSS ** -->
<!-- base library -->
<link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" />

<!-- overrides to base library -->


<!-- ** Javascript ** -->
<!-- base library -->
<script type="text/javascript" src="../../adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="../../ext-all-debug.js"></script>


<!-- overrides to base library -->

<!-- extensions -->

<!-- page specific -->

<script type="text/javascript">
Ext.BLANK_IMAGE_URL = '../../resources/images/default/s.gif';

Ext.onReady(function(){

//your onReady code here
var propPanel = new Ext.grid.PropertyGrid({
id: 'prop_grid',
title: 'Setting Grid',
margins: '5 5 5 1',
stripeRows: true,
renderTo: 'grid-example',
width: 400,
height: 300,
source: {}
});

// Disable sorting of the propertyGrid
propPanel.getColumnModel().setConfig([
{header: 'Attribute', sortable: false, dataIndex: 'name', id:'name'},
{header: 'Value', sortable: false, dataIndex: 'value', id:'value'}
]);

var rec = new Ext.grid.PropertyRecord({
name: 'Field1',
value: '123'
});
propPanel.store.add(rec);

rec = new Ext.grid.PropertyRecord({
name: 'Field2',
value: '456'
});
propPanel.store.add(rec);

}); //end onReady
</script>

</head>
<body>
<div id="grid-example"></div>
</body>
</html>