PDA

View Full Version : How to add a calendar in ExtJS PropertyGrid



sachin sachdeva
3 Dec 2010, 12:04 AM
HELLO SIR
I am using a property grid and populating it wid a json data .My property grid is editable.Now My requirement is dthat wen ever user edits a date field it must show a calender .i am sending my code and screen shots plz have a look at them and tell me if this is possible or not

GeneralpropsGrid = new Ext.grid.PropertyGrid(
{
title : 'General Properties',
isEditable : true,
listeners : {
beforeedit : function(
rowIndex, grid) {
return this.checkIfEditable(rowIndex.record.id);
}
},checkIfEditable : function(
field) {
if (field == 'Title')
return true;
else if (field == 'Tags')
return true;

else if (field == 'Comments')
return true;

else if (field == 'Expiration Date')
return true;

else if (field == 'Content Category')
return true;
else if (field == 'Searchable')
return true;

else {
return false;
}
}




onSelect : function(record) {

source "{"

"\"Size\":\" " + record.data.size + "\"," + ""
+ "\"Author\":\"" + record.data.author + "\"," + ""
+ "\"File Name\":\"" + record.data.fileName + "\" ,"
+ "" + "\"Title\":\"" + record.data.title + "\" ," + ""
+ "\"Extension\":\"" + record.data.extension + "\" ,"
+ "" + "\"Release Date\":\"" + record.data.releasedate
+ "\" ," + "" + "\"Expiration Date\":\"" + record.data.expdate + "\" ,"
+ "" + "\"Searchable\":\"" + record.data.searchable + "\" ,"
+ "" + "\"Tags\":\"" + record.data.tags + "\" ," + ""
+ "\"Content Category\":\"" + record.data.contentCategory + "\" ,"
+ "" + "\"Comments\":\"" + record.data.comments
+ "\" ," + "" + "\"Websites\":\""
+ record.data.websites + "\" " +
// ""+ "\"Expiration Date\":\"" + dataRow.data.expdate +
// "\"
// " +
"}";

GeneralpropsGrid.setSource(eval('(' + source + ')'));

Condor
3 Dec 2010, 12:28 AM
A PropertyGrid would already do that if the property value was a Date instance.

sachin sachdeva
3 Dec 2010, 3:34 AM
we are using json to populate the property grid ,i am sending you another attachment which is shown after i have made changes in my cod shown below plz see the lines marked as star
source = "{" +

"\"Size\":\" " + dataRow.data.size + "\"," + "" + "\"Author\":\""
+ dataRow.data.author + "\"," + "" + "\"File Name\":\""
+ dataRow.data.fileName + "\" ," + "" + "\"Title\":\""
+ dataRow.data.title + "\" ," + "" + "\"Extension\":\""
+ dataRow.data.extension + "\" ," + ""
+ "\"Release Date\":\"" + dataRow.data.releasedate + "\" ,"
********** + "\"Expiration Date\":\"" + new Ext.form.DateField( ************************

)+ "\" ," + "" + "\"Searchable\":\"" + dataRow.data.searchable
+ "\" ," + "" + "\"Tags\":\"" + dataRow.data.tags + "\" ,"
+ "" + "\"Content Category\":\"" + dataRow.data.contentCategory + "\" ,"
+ "" + "\"Comments\":\"" + dataRow.data.comments + "\" ,"
+ "" + "\"Websites\":\"" + dataRow.data.websites + "\" " +
// ""+ "\"Expiration Date\":\"" + dataRow.data.expdate + "\"
// " +
"}";



GeneralpropsGrid.setSource(eval('(' + source + ')'));



plz help me ......

Condor
3 Dec 2010, 3:41 AM
And what does Ext.isDate(dataRow.data.expdate) return?

It needs to be 'true' for the DateField editor to show.

sachin sachdeva
3 Dec 2010, 10:51 PM
hi condor ..........mate it is true i have checked that but still its is not working actually we are using json as i ahve told u before to populate the grid....Now plz sahre your knowledge and tell me if it is possible to add a date field in json or not if so can u plzzzzzzzzz quote some examples


Thanx a lot for ur timely help