PDA

View Full Version : Date column in the grid displaying date as in String



madhav.msd
11 Nov 2012, 10:57 PM
Hello Team,

With respect to the request raised in Q&A(http://www.sencha.com/forum/showthread.php?247400-Dynamic-Tree-grid-in-Extjs-4.1&p=906871).

We having an issue with the Date column in the grid. We using a custom datepicker which will show only the MONTH and YEAR. Our system will calculate the date depends on the requirements.

My grid has the date value, when i want to modify it by clicking the datepicker, the datepicker is not showing the cell date value, instead it is displaying blank for the first time. And then it is displaying the selected value in the datepicker on further modification.

Please note:
The same datepicker is used by another grid by the xtype as datacolumn where it is working fine as expected. We are facing the issue only in the dynamic grid.And also the format config is not working for the Date column, so we converting the date value as per our desired format dd-mmm-yyyy by a function and it will return the value as string.

Find the screen shot attached for this issue.

mitchellsimoens
13 Nov 2012, 5:46 PM
Is the value being set on the field?

madhav.msd
14 Nov 2012, 4:38 AM
Thanks for you response!...

When data comes from the server side, my store has all values and displaying in the grid properly.

While modifying the date in the client side, Not sure on that. Because we calculating the date for the selected Month and year, and manually using set method to set values.(date column belong to the associated model, that's why we using set method to set the value to the record)

madhav.msd
7 Dec 2012, 3:08 AM
After implementing the below code, all the value and rawValue has been modified with my new dates. But the monthpicker is not display the value which I set to it. By default it is showing current system date as selected and the textfield is empty.

var cellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit : 1,
listeners : {
'beforeedit' : function(editor, e, eOpts) {
if (e.record.get('leaf')) {

if(e.colIdx > 4){
var montheditor = e.column.getEditor(e.record,null);
var dateValue = e.record.myDates().getAt(e.colIdx - 4).get('date');
montheditor.setValue(dateValue);
montheditor.getPicker().setValue(dateValue);
}

}else{
e.cancel = true;
}
}
});