Вот как я это сделал: Сначала я сделал функцию:
var ImagedbyDate = function(){
$(document).ready(function(){
// GET ALL THE DATES BETWEEN TWO SELECTED DAYS AND STORE THEM IN AN ARRAY (allDates[])
var startDateStr = Ext.getCmp('startDateFoi').getSubmitValue();
alert(startDateStr);
var endDateStr = Ext.getCmp('endDateFoi').getSubmitValue();
alert(endDateStr);
currentDate = new Date(startDateStr);
endDate = new Date(endDateStr);
alert(currentDate);
allDates = [];
while (currentDate <= endDate) {
allDates.push(new Date(currentDate));
currentDate.setDate(currentDate.getDate() + 1);
}
На самом деле я добавил эти две строки:
currentDate = new Date(startDateStr);
endDate = new Date(endDateStr);
Это выглядит как мои детали:
{
region: 'center',
title: "Rural Broadband",
layout: 'fit',
collapsible: false,
items: [mappanel] , //mapPanel
dockedItems: [{ //Toolbar with Actions - Beginn
xtype: 'toolbar',
dock: 'top',
items: [{
text: 'Current center of the map',
handler: function(){
var c = GeoExt.panel.Map.guess().map.getCenter();
Ext.Msg.alert(this.getText(), c.toString());
}
},{
text: 'See Unassigned Images',
handler: function(){
UnassignedImg();
}
},
{
fieldLabel: 'Start Date',
name: 'startDate',
xtype: 'datefield',
id: 'startDateFoi',
format: 'd-M-Y'
},
{
fieldLabel: 'End Date',
name: 'startDate',
id: 'endDateFoi',
xtype: 'datefield',
format: 'd-M-Y'
}, ...
Я надеюсь, что это поможет кому-то.
Это довольно длинный ветер и сложность, см. Мой ответ на однострочное решение, а не на цикл – Scriptable