PDA

View Full Version : set startdate of Ext gantt from database



rushi2440
14 Mar 2012, 12:56 AM
Hi
I am working with Extjs 4 and MVC.
I am having one problem in which I want to set the startdate of Ext ganttPanel from the database
value which I received.

Currently I am setting the stardate and enddate of Ext ganttPanel with the below code


var start = new Date(2010, 0, 1),
end = Sch.util.Date.add(start, Sch.util.Date.MONTH, 30);

but I want to set the start and end value dynamically with the values received from the database.

vietits
14 Mar 2012, 1:18 AM
var start = new Date(DateValueFromDatabase);
var end = Sch.util.Date.add(start, Sch.util.Date.MONTH, 30);

DateValueFromDatabase must be one of the following:

Integer value representing the number of milliseconds since 1 January 1970 00:00:00 UTC (Unix Epoch).
String value representing a date. The string should be in a format recognized by the parse method (IETF-compliant RFC 1123 timestamps).

rushi2440
14 Mar 2012, 1:37 AM
Hi vietits
thanks for the reply

I am getting my server response as

{
"calendardata": [{
"startdate": 1330281000000,
"enddate": 1330284600000,
"id": 3,
"title": "mon"
}],
"total": 1,
"success": true
}


how can I set the startdate and enddate from my json ressponse to


var start = new Date(DateValueFromDatabase);
var end = Sch.util.Date.add(start, Sch.util.Date.MONTH, 30);

I tried replacing DateValueFromDatabase with startdate received as json response, but nothing happens.
So please can you suggest me how can I set startdate and enddate of this variables.

chramer
14 Mar 2012, 1:49 AM
you can use "Ext.JSON.decode (http://docs.sencha.com/ext-js/4-0/#%21/api/Ext.JSON-method-decode)" like so

var result = Ext.JSON.decode('{"calendardata": [{"startdate": 1330281000000,"enddate": 1330284600000,"id": 3,"title": "mon"}],"total": 1,"success": true}');

var startdate = result.calendardata[0].startdate;
var enddate= result.calendardata[0].enddate;

rushi2440
14 Mar 2012, 8:46 PM
@vietits

below is my ganttChart panel view

var result = Ext.JSON.decode('{"calendardata": [{"startdate": 1330281000000,"enddate": 1330284600000,"id": 3,"title": "mon"}],"total": 1,"success": true}');


//var start = new Date(2012, 2, 26),
//end = Sch.util.Date.add(start, Sch.util.Date.MONTH, 30);


var start = result.calendardata[0].startdate;
end = result.calendardata[0].enddate;


//create the downloadframe at the init of your app
this.downloadFrame = Ext.getBody().createChild({
tag: 'iframe'
, cls: 'x-hidden'
, id: 'iframe'
, name: 'iframe'
});
//create the downloadform at the init of your app


this.downloadForm = Ext.getBody().createChild({
tag: 'form'
, cls: 'x-hidden'
, id: 'form'
, target: 'iframe'
});

var printableMilestoneTpl = new Gnt.template.Milestone({
prefix : 'foo',
printable : true,
imgSrc : 'resources/images/milestone.png'
});


var params = new Object();
Ext.define('gantt.view.projectmgt.projectGanttpanel', {
extend: "Gnt.panel.Gantt",
id: 'projectganttpanel',
alias: 'widget.projectganttpanel',
requires: [
'Gnt.plugin.TaskContextMenu',
'Gnt.column.StartDate',
'Gnt.column.EndDate',
'Gnt.column.Duration',
'Gnt.column.PercentDone',
'Gnt.column.ResourceAssignment',
'Sch.plugin.TreeCellEditing',
'Sch.plugin.Pan',
'gantt.store.taskStore',
'gantt.store.dependencyStore'
],
leftLabelField: 'Name',
loadMask: true,
//width: '100%',
// height: '98%',
startDate: start,
endDate: end,
multiSelect: true,
cascadeChanges: true,
viewPreset: 'weekAndDayLetter',
recalculateParents: false,
showTodayLine : true,
showBaseline : true,


initComponent: function() {
var me = this;
me.on({
scope: me,
beforeload: function(store,records,options) {
console.log('BEFORE LOAD YAAR panel');
if(records.params['id'] != null)
{
return true;
}
else
{
return false;
}
}
});


TaskPriority = {
Low : 0,
Normal : 1,
High : 2
};
var taskStore = Ext.create('gantt.store.taskStore');
var dependencyStore = Ext.create('gantt.store.dependencyStore');


Ext.apply(me, {
taskStore: taskStore,
dependencyStore: dependencyStore,

// Add some extra functionality
plugins : [
Ext.create("Gnt.plugin.TaskContextMenu"),
Ext.create('Sch.plugin.TreeCellEditing', {
clicksToEdit: 1
}),
Ext.create('Gnt.plugin.Printable', {
printRenderer : function(task, tplData) {
if (task.isMilestone()) {
return;
} else if (task.isLeaf()) {
var availableWidth = tplData.width - 4,
progressWidth = Math.floor(availableWidth*task.get('PercentDone')/100);

return {
// Style borders to act as background/progressbar
progressBarStyle : Ext.String.format('width:{2}px;border-left:{0}px solid #7971E2;border-right:{1}px solid #E5ECF5;', progressWidth, availableWidth - progressWidth, availableWidth)
};
} else {
var availableWidth = tplData.width - 2,
progressWidth = Math.floor(availableWidth*task.get('PercentDone')/100);

return {
// Style borders to act as background/progressbar
progressBarStyle : Ext.String.format('width:{2}px;border-left:{0}px solid #FFF3A5;border-right:{1}px solid #FFBC00;', progressWidth, availableWidth - progressWidth, availableWidth)
};
}
},
beforePrint : function(sched) {
var v = sched.getSchedulingView();
this.oldRenderer = v.eventRenderer;
this.oldMilestoneTemplate = v.milestoneTemplate;
v.milestoneTemplate = printableMilestoneTpl;
v.eventRenderer = this.printRenderer;
},


afterPrint : function(sched) {
var v = sched.getSchedulingView();
v.eventRenderer = this.oldRenderer;
v.milestoneTemplate = this.oldMilestoneTemplate;
}
})
],
eventRenderer: function (task) {
var prioCls;
switch (task.get('Priority')) {
case TaskPriority.Low:
prioCls = 'sch-gantt-prio-low';
break;


case TaskPriority.Normal:
prioCls = 'sch-gantt-prio-normal';
break;


case TaskPriority.High:
prioCls = 'sch-gantt-prio-high';
break;
}


return {
cls: prioCls
};
},


// Setup your static columns
columns: [
{
xtype : 'treecolumn',
header: 'Tasks',
dataIndex: 'Name',
width: 150,
field: new Ext.form.TextField()
},
new Gnt.column.StartDate(),
new Gnt.column.Duration(),
new Gnt.column.PercentDone(),
{
header: 'Priority',
width: 50,
dataIndex: 'Priority',
renderer: function (v, m, r) {
switch (v) {
case TaskPriority.Low:
return 'Low';


case TaskPriority.Normal:
return 'Normal';


case TaskPriority.High:
return 'High';
}
}
},
{
xtype : 'booleancolumn',
width : 50,

header : 'Manual',

dataIndex : 'ManuallyScheduled',

field : {
xtype : 'combo',
store : [ 'true', 'false' ]
}
}
],
tooltipTpl: new Ext.XTemplate(
'<h4 class="tipHeader">{Name}</h4>',
'<table class="taskTip">',
'<tr><td>Start:</td> <td align="right">{[Ext.Date.format(values.StartDate, "y-m-d")]}</td></tr>',
'<tr><td>End:</td> <td align="right">{[Ext.Date.format(Ext.Date.add(values.EndDate, Ext.Date.MILLI, -1), "y-m-d")]}</td></tr>',
'<tr><td>Progress:</td><td align="right">{PercentDone}%</td></tr>',
'</table>'
).compile(),


tbar: [{
xtype: 'buttongroup',
title: 'Navigation',
columns: 2,
defaults: {
scale: 'small'
},
items: [{
iconCls : 'icon-prev',
scope : this,
handler : function() {
this.shiftPrevious();
}
},
{
iconCls : 'icon-next',
scope : this,
handler : function() {
this.shiftNext();
}
},{
text : 'Expand all',
iconCls : 'icon-expandall',
scope : this,
handler : function() {
this.expandAll();
}
}]
},{
xtype: 'buttongroup',
title: 'View tools',
columns: 2,
defaults: {
scale: 'small'
},
items: [
{
text : 'Collapse all',
iconCls : 'icon-collapseall',
scope : this,
handler : function() {
this.collapseAll();
}
},
{
text : 'Zoom to fit',
iconCls : 'zoomfit',
handler : function() {
this.zoomToFit();
},
scope : this
},
{
text : 'Expand all',
iconCls : 'icon-expandall',
scope : this,
handler : function() {
this.expandAll();
}
},
{
text : 'Zoom out',
iconCls : 'icon-zoom-out',
scope : this,
handler : function() {
console.log('ZOOM OUT PRESSED');
}
}
]
},{
xtype: 'buttongroup',
title: 'View resolution',
columns: 2,
defaults: {
scale: 'small'
},
items: [{
text: '10 weeks',
scope : this,
handler : function() {
this.switchViewPreset('weekAndDayLetter');
}
},
{
text: '1 year',
scope : this,
handler : function() {
this.switchViewPreset('monthAndYear');
}
},{
text : 'Show baseline',
scope: this,
enableToggle : true,
pressed : true,
handler : function() {
this.el.toggleCls('sch-ganttpanel-showbaseline');
}
}
]},{
xtype: 'buttongroup',
title: 'Themes',
columns: 2,
defaults: {
scale: 'small'
},
items: [
{
text : 'Style 1',
iconCls : 'theme',
handler : function() {
Ext.getBody().removeCls(['style2', 'style3']).addCls('style1');
}
},
{
text : 'Style 2',
iconCls : 'theme',
handler : function() {
Ext.getBody().removeCls(['style1', 'style3']).addCls('style2');
}
},
{
iconCls : 'theme',
text : 'Style 3',
handler : function() {
Ext.getBody().removeCls(['style2', 'style1']).addCls('style3');
}
}
]
},
{
xtype: 'buttongroup',
title: 'Report generation',
columns: 2,
defaults: {
scale: 'small'
},
items: [{
iconCls : 'icon-excel',
text : 'Export to XLS',
handler : function(button, event){
//code goes here
Ext.Ajax.request({
url: 'task/GetTaskReportXLS.action',
params: params,
form: App.downloadForm,
isUpload: true,
// method: 'POST',
success : function(response, option){
//this.gestioneRisposta(response);
console.log("success");
}
,failure :function(response, option){
console.log("failure");
}
,scope : this
});
}
},
{
iconCls : 'icon-pdf',
text : 'Export to PDF',
handler : function(button, event){
//code goes here
Ext.Ajax.request({
url: 'task/GetTaskReportPDF.action',
params: params,
form: App.downloadForm,
isUpload: true,
success : function(response, option){
//this.gestioneRisposta(response);
console.log("success");
}
,failure :function(response, option){
console.log("failure");
}
,scope : this
});
}
},{
iconCls : 'icon-csv',
text : 'Export to CSV',
handler : function(button, event){
//code goes here
Ext.Ajax.request({
url: 'task/GetTaskReportCSV.action',
params: params,
form: App.downloadForm,
isUpload: true,
// method: 'POST',
success : function(response, option){
//this.gestioneRisposta(response);
console.log("success");
}
,failure :function(response, option){
console.log("failure");
}
,scope : this
});
}
},
]},
{
xtype: 'buttongroup',
title: 'Try some features...',
columns : 2,
defaults: {
scale: 'small'
},
items: [{
iconCls : 'action',
text : 'Scroll to last task',
scope : this,

handler : function(btn) {
var latestEndDate = new Date(0),
latest;
this.taskStore.getRootNode().cascadeBy(function(task) {
if (task.get('EndDate') >= latestEndDate) {
latestEndDate = task.get('EndDate');
latest = task;
}
});
this.getSchedulingView().scrollEventIntoView(latest, true);
}
},
{
xtype : 'textfield',
emptyText : 'Search for task...',
scope : this,
width:150,
enableKeyEvents : true,
listeners : {
keyup : {
fn : function(field, e) {
var value = field.getValue();

if (value) {
this.taskStore.filter('Name', field.getValue(), true, false);
} else {
this.taskStore.clearFilter();
}
},
scope : this
},
specialkey : {
fn : function(field, e) {
if (e.getKey() === e.ESC) {
field.reset();
}
this.taskStore.clearFilter();
},
scope : this
}
}
},{
text : 'Expand all',
iconCls : 'icon-expandall',
scope : this,
handler : function() {
this.expandAll();
}
}]
},{
xtype: 'buttongroup',
title: 'CRUD OPERATION',
columns: 2,
defaults: {
scale: 'small'
},
items: [{
text: 'Save',
iconCls: 'icon-save',
handler: function () {
taskStore.sync();
}
},
{
text: 'Add new Root Node',
iconCls: 'icon-new',
handler: function () {
taskStore.getRootNode().appendChild(new taskStore.model({
Name: 'New Task',
PercentDone: 60,
StartDate : new Date(2011, 0, 30),
Duration: 1.0,
DurationUnit: 'd',
leaf: true
})
);
taskStore.sync();
}
},{
text : 'Reload Task',
iconCls : 'icon-reload',
scope : this,
handler : function() {
Ext.data.StoreManager.lookup('taskStore').load();
}
}
]},{
xtype: 'buttongroup',
title: 'Print Gantt',
columns: 2,
defaults: {
scale: 'small'
},
items: [{
iconCls : 'icon-print',
scale : 'large',
text : 'Print',
scope: this,
handler : function() {
// Make sure this fits horizontally on one page.
this.zoomToFit();
this.print();
}
}]
},
]

});

me.callParent(arguments);


}
});


I had just changed the

var start = new Date(2012, 2, 26),
end = Sch.util.Date.add(start, Sch.util.Date.MONTH, 30);
to


var start = result.calendardata[0].startdate;
end = result.calendardata[0].enddate;


but it gives me error date.getTime is not a function

please help me to find what there wrong in my code, so I can make changes and make I working.


Yogendra Singh
Sr. Programmer
Kintudesigns.com

chramer
14 Mar 2012, 10:52 PM
just a good practice :)

var start = result.calendardata[0].startdate,
end = result.calendardata[0].enddate;

are you able to determine the line where the error occurs ?

when you do

console.log(start);
console.log(end);
does it shows the dates ?

vietits
14 Mar 2012, 10:55 PM
var start = result.calendardata[0].startdate;
end = result.calendardata[0].enddate;

start and end variables are not Date object, so you should fix your code as below:


var start = new Date(result.calendardata[0].startdate);
var end = new Date(result.calendardata[0].enddate);

rushi2440
14 Mar 2012, 11:18 PM
@vietits

thanks for your response I tried to change my variable to

var start = new Date(result.calendardata[0].startdate);
var end = new Date(result.calendardata[0].enddate);

but still it gives me an error

uncaught exception: Invalid time axis configuration or filter, please check your input data.

So now what is wrong here. I made the changes as you said but still not working. Any other way to get it working

Yogendra Singh
Sr. Programmer
Kintudesigns.com

rushi2440
14 Mar 2012, 11:35 PM
just a good practice :)

var start = result.calendardata[0].startdate,
end = result.calendardata[0].enddate;

are you able to determine the line where the error occurs ?

when you do

console.log(start);
console.log(end);
does it shows the dates ?

yes my console shows me date only like
Date {Mon Feb 27 2012 00:00:00 GMT+0530 (India Standard Time)}

Date {Mon Feb 27 2012 01:00:00 GMT+0530 (India Standard Time)}

now what's wrong with the code ?I am not able to figure out what's the problem in my code above.

vietits
15 Mar 2012, 12:40 AM
@vietits

thanks for your response I tried to change my variable to

var start = new Date(result.calendardata[0].startdate);
var end = new Date(result.calendardata[0].enddate);

but still it gives me an error

uncaught exception: Invalid time axis configuration or filter, please check your input data.

So now what is wrong here. I made the changes as you said but still not working. Any other way to get it working

Yogendra Singh
Sr. Programmer
Kintudesigns.com
My fix is only to make sure start and end variables are Date object because with your code these variables are just numbers representing dates in miliseconds.


var result = Ext.JSON.decode('{"calendardata": [{"startdate": 1330281000000,"enddate": 1330284600000,"id": 3,"title": "mon"}],"total": 1,"success": true}');


//var start = new Date(2012, 2, 26),
//end = Sch.util.Date.add(start, Sch.util.Date.MONTH, 30);


var start = result.calendardata[0].startdate; <- This is not Date object
end = result.calendardata[0].enddate; <- This is not Date object

rushi2440
8 May 2012, 12:05 AM
hi.. vietits

I am having one controller and from it I am opening the window by calling the below function

var win = this.getTaskAdd();
win.projectid = rec.get('id');
win.show();


this projectid is assigned to the projectid variable of Window and my window contains the xtype:'taskpanel'

my window code is

Ext.define('rms.view.projectmgt.taskAdd' ,{
extend: 'Ext.Window',
alias : 'widget.taskaddwindow',
requires: ['rms.view.projectmgt.taskPanel'],
id: 'taskaddwindow',
title: 'Project Management',
width: '85%',
height: '85%',
closeAction: 'destroy',
closable : true,
modal: true,
constrain: true,
maximizable: true,
stateful: false,
projectid: null, // this will be set before showing window
layout: 'border',

initComponent: function() {

this.layoutConfig = {
align: 'stretch'
};
this.items = [
{
region: 'center',
xtype: 'taskpanel',
width: '85%',
height: '85%'
}
];

this.callParent(arguments);
}
});


I am able to get the view of taskpanel correctly, but I want to set the startDate and endDate of the taskpanel from the server response I am getting.

But I am not able to assign the startDate and endDate to my taskPanel.

In my controller I am using the below function to get the server response and for setting the taskpanel startDate and the endDate.

var win = this.getTaskAdd();
win.projectid = rec.get('id');


var panel = this.getTaskPanel();


win.on("beforeshow", function(window) {
console.log('WINDOW VALUES ::' + window);
var projectid = this.projectid;
console.log('BEFOR SHOW 1::' + projectid);
if (projectid != null) {


var store = Ext.data.StoreManager.lookup('task');
store.load({
params: {
'projectid': this.projectid
},
callback: function(records, operation, success) {
//console.log(records);
//console.log("HELLO "+operation.response.responseText);
sc_val = Ext.decode(operation.response.responseText);
data = sc_val.taskdata;
console.log("STARTDATE " + data[0].startdate);
console.log("ENDDATE " + data[0].enddate);


start_d = new Date(data[0].startdate);
end_d = new Date(data[0].enddate);


startdate = new Date(start_d.getFullYear(), start_d.getMonth(), start_d.getDate());
enddate = Sch.util.Date.add(startdate, Sch.util.Date.MONTH, 30);


panel.startDate = startdate;
panel.endDate = enddate;


//taskpanel.result =data;
//console.log('TASKPANE DATA '+taskpanel.result);
}
});


}
});


console.log('TASKPANE DATA ' + panel.endDate);
console.log('TASKPANE DATA ' + panel.startDate);


win.show();


my console shows me the startDate and endDate of the taskpanel correctly. But my view didn't come the way I want. startDate and endDate are null still.

Please suggest me some solution I can try to make it work. I am getting the startDate and the endDate correctly but I am getting it after the window.show() function executes.


Yogendra Singh
Sr. Programmer
Kintudesigns.com

vietits
8 May 2012, 12:26 AM
var win = this.getTaskAdd();
win.projectid = rec.get('id');


var panel = this.getTaskPanel();


win.on("beforeshow", function(window) {
console.log('WINDOW VALUES ::' + window);
var projectid = this.projectid;
console.log('BEFOR SHOW 1::' + projectid);
if (projectid != null) {


var store = Ext.data.StoreManager.lookup('task');
store.load({
params: {
'projectid': this.projectid
},
callback: function(records, operation, success) {
//console.log(records);
//console.log("HELLO "+operation.response.responseText);
sc_val = Ext.decode(operation.response.responseText);
data = sc_val.taskdata;
console.log("STARTDATE " + data[0].startdate);
console.log("ENDDATE " + data[0].enddate);


start_d = new Date(data[0].startdate);
end_d = new Date(data[0].enddate);

startdate = new Date(start_d.getFullYear(), start_d.getMonth(), start_d.getDate());
enddate = Sch.util.Date.add(startdate, Sch.util.Date.MONTH, 30);


panel.startDate = startdate;
panel.endDate = enddate;
// What do you get here?
console.log(panel.startDate, panel.endDate)


//taskpanel.result =data;
//console.log('TASKPANE DATA '+taskpanel.result);
}
});
}
});

// here panel.startDate and panel.endDate will be null because the window does not show -> beforeshow won't be fired yet -> store.load() won't be called
console.log('TASKPANE DATA ' + panel.endDate);
console.log('TASKPANE DATA ' + panel.startDate);


win.show();

rushi2440
8 May 2012, 12:46 AM
@Vietits

thanks for your reply.

my console gives me below output

console.log(panel.startDate, panel.endDate)


Date {Mon Apr 30 2012 00:00:00 GMT+0530 (IST)} Date {Thu Oct 30 2014 00:00:00 GMT+0530 (IST)}




and my taskpanel code is

Ext.define('rms.view.projectmgt.taskPanel', {
extend: "Gnt.panel.Gantt",
id: 'taskpanel',
alias: 'widget.taskpanel',
requires: [
'Gnt.plugin.TaskContextMenu',
'Gnt.column.StartDate',
'Gnt.column.EndDate',
'Gnt.column.Duration',
'Gnt.column.PercentDone',
'Gnt.column.ResourceAssignment',
'Sch.plugin.TreeCellEditing',
'Sch.plugin.Pan'
],
leftLabelField: 'Name',
loadMask: true,
startDate: null,
endDate: null,


I want to set this startDate and endDate with this values from my controller.


startdate = new Date(start_d.getFullYear(), start_d.getMonth(), start_d.getDate());
enddate = Sch.util.Date.add(startdate, Sch.util.Date.MONTH, 30);

vietits
8 May 2012, 2:01 AM
Then you just place the code of win.on('beforeshow', ...) in your controller.

rushi2440
8 May 2012, 2:44 AM
@Vietis

I had done that only in my controller like below is my controller code


win.on("beforeshow", function (window) {
console.log('WINDOW VALUES ::' + window);
var projectid = this.projectid;
console.log('BEFOR SHOW 1::' + projectid);
if (projectid != null) {
var store = Ext.data.StoreManager.lookup('task');
store.load({
params: {
'projectid': this.projectid
},
callback: function (records, operation, success) {
//console.log(records);
//console.log("HELLO "+operation.response.responseText);
sc_val = Ext.decode(operation.response.responseText);
data = sc_val.taskdata;
console.log("STARTDATE " + data[0].startdate);
console.log("ENDDATE " + data[0].enddate);
start_d = new Date(data[0].startdate);
end_d = new Date(data[0].enddate);
startdate = new Date(start_d.getFullYear(), start_d.getMonth(), start_d.getDate());
enddate = Sch.util.Date.add(startdate, Sch.util.Date.MONTH, 30);
panel.startDate = startdate;
panel.endDate = enddate;
}
});
}
});



but still my startDate and endDate is not setting in my taskpanel.

Please suggest me what I need to change in my controller to make it working.

vietits
8 May 2012, 10:25 PM
win.on("beforeshow", function (window) {
console.log('WINDOW VALUES ::' + window);
var projectid = this.projectid;
console.log('BEFOR SHOW 1::' + projectid);
if (projectid != null) {
var store = Ext.data.StoreManager.lookup('task');
store.load({
params: {
'projectid': this.projectid
},
callback: function (records, operation, success) {
//console.log(records);
//console.log("HELLO "+operation.response.responseText);
sc_val = Ext.decode(operation.response.responseText);
data = sc_val.taskdata;
console.log("STARTDATE " + data[0].startdate);
console.log("ENDDATE " + data[0].enddate);
start_d = new Date(data[0].startdate);
end_d = new Date(data[0].enddate);
startdate = new Date(start_d.getFullYear(), start_d.getMonth(), start_d.getDate());
enddate = Sch.util.Date.add(startdate, Sch.util.Date.MONTH, 30);
panel.startDate = startdate;
panel.endDate = enddate;
}
});
}
});

What is the purpose of the code marked with red color above? Does it set startDate and endDate to your taskpanel?

rushi2440
9 May 2012, 2:33 AM
@Vietits

thanks for your response
with this two lines below I am able to get the startDate and the endDate from the server response.

panel.startDate = startdate;
panel.endDate = enddate;

and as soon as I get this values I want to set them to taskPanel variable. But the above two values display the values to my console after the view is shown. So I am not able to set the startDate and endDate to taskPanel.

Based on server response want to set the panel's startDate and endDate and so when view is shown it has the startDate and endDate same as the server response

vietits
9 May 2012, 5:34 PM
From your code, taskPanel is a child component of the taskAdd window, so it will be created (and shown) when a taskAdd window created. This will often happen before getting requested data from server. To say another word, you can only set startDate/endDate of taskPanel component in taskAdd window after it has been shown.

rushi2440
9 May 2012, 8:35 PM
@Vietits

thanks for your response

But I want to set the taskpanel's startDate and endDate before the taskAdd window is shown.
So when the taskAdd window comes with taskPanel it has startDate and endDate.

Do you have any other solution I can try to set them and show them as the taskAdd window is shown.

vietits
10 May 2012, 4:40 PM
The solutions for your case are:
1. Modifying your view code to update the view after it has been shown.
2. Instead of creating and showing the view with the window, try to create it when you get startDate and endDate, then add it to the window.