PDA

View Full Version : value not being passed to php



banesto
24 Nov 2007, 9:58 AM
i have a grouping editable grid, all values on update are passing to php file but in case of one - date - value is not showing up in firebug, only other data like field and stuff.. can anyone point out the reason for that?

Here's the code:

[CODE]Ext.onReady(function(){

Ext.QuickTips.init();

var xg = Ext.grid;

var Task = Ext.data.Record.create([
{name: 'done', type: 'int'},
{name: 'project', type: 'string'},
{name: 'id', type: 'int'},
{name: 'task', type: 'string'},
{name: 'hours', type: 'float'},
{name: 'rate', type: 'float'},
{name: 'cost', type: 'float'},
{name: 'date', type: 'date', dateFormat:'d/m/Y'}
]);

var reader = new Ext.data.JsonReader({
root: 'results',
totalProperty: 'count',
id: 'id'},
Task);

var ds = new Ext.data.GroupingStore({
proxy: new Ext.data.HttpProxy({url: 'data.php?task=showData'}),
reader: reader,
sortInfo: {field: 'date', direction: "ASC"},
groupField:'project'
});

ds.load();

// define a custom summary function
Ext.grid.GroupSummary.Calculations['totalCost'] = function(v, record, field){
return v + (record.data.hours * record.data.rate);
}

var summary = new Ext.grid.GroupSummary();

var grid = new xg.EditorGridPanel({
ds: ds,
columns: [
{
id: 'id',
header: "id",
width: 20,
sortable: true,
dataIndex: 'id',
hideable: true,
hidden: true
},
//checkColumn,
{
header: "Projekts",
width: 20,
sortable: true,
dataIndex: 'project',
editor: new Ext.form.ComboBox({
typeAhead: true,
triggerAction: 'all',
transform:'projekti',
lazyRender:true,
forceSelection: false,
listClass: 'x-combo-list-small'
})
},{
id: 'task',
header: "Uzdevums",
width: 80,
sortable: true,
dataIndex: 'task',
summaryType: 'count',
hideable: false,
summaryRenderer: function(v, params, data){
return ((v === 0 || v > 1) ? '(' + v +' Uzdevumi)' : '(1 Uzdevums)');
},
editor: new Ext.form.TextField({
allowBlank: false
})
},{
header: "Datums",
width: 25,
sortable: true,
dataIndex: 'date',
summaryType:'max',
renderer: Ext.util.Format.dateRenderer('d/m/Y'),
editor: new Ext.form.DateField({
format: 'd/m/Y',
minValue: '01/04/2005'
})
},{
header: "Stundas",
width: 20,
sortable: true,
dataIndex: 'hours',
summaryType:'sum',
renderer : function(v){
return v +' st';
},
editor: new Ext.form.NumberField({
allowBlank: false,
allowNegative: false,
style: 'text-align:left'
})
},{
header: "Likme",
width: 20,
sortable: true,
renderer: function(v){
return v +' Ls/h';
},
dataIndex: 'rate',
summaryType:'average',
editor: new Ext.form.NumberField({
allowBlank: false,
allowNegative: false,
style: 'text-align:left'
})
},{
id: 'cost',
header: "Summa",
width: 20,
sortable: false,
groupable: false,
renderer: function(v, params, record){
return (record.data.hours * record.data.rate) + ' Ls';
},
dataIndex: 'cost',
summaryType:'totalCost',
summaryRenderer: function(v){
return v +' Ls';
}
}
],

view: new Ext.grid.GroupingView({
forceFit:true,
showGroupName: false,
enableNoGroups:false, // REQUIRED!
hideGroupedColumn: true
}),

plugins: summary,

frame:true,
width: 800,
height: 450,
clicksToEdit: 2,
collapsible: true,
animCollapse: false,
trackMouseOver: false,
//enableColumnMove: false,
title: 'Timetracker',
iconCls: 'icon-grid',
renderTo: document.body,
selModel: new Ext.grid.RowSelectionModel({singleSelect:false}),
//stripeRows: true,//applies css classname to alternate rows, defaults to false
tbar: [{
text: 'Pievienot uzdevumu',
tooltip:'Jauna uzdevuma pievieno

hendricd
24 Nov 2007, 10:25 AM
Since the date (which in the Store is a Date object) value is going into params, you'll likely need to coerce it to a string (in the expected format 'd/m/y') , much like your grids date renderer function does.

banesto
24 Nov 2007, 10:53 AM
oh, yeah, thanks. forgot about that..


var field = oGrid_Event.field;
if (field == 'date')
value = Ext.util.Format.date(oGrid_Event.value, 'd/m/Y')
else
value = oGrid_Event.value

banesto
24 Nov 2007, 4:44 PM
do you know how to get datepicker to start week at monday, not sunday?

tryanDLS
24 Nov 2007, 4:48 PM
Please read the API doc - see the startDay config.

banesto
25 Nov 2007, 5:36 AM
hmm, datepicker is not the datefield, is it?


{
header: "Datums",
width: 25,
sortable: true,
dataIndex: 'date',
summaryType:'max',
renderer: Ext.util.Format.dateRenderer('d/m/Y'),
editor: new Ext.form.DateField({
format: 'd/m/Y',
minValue: '01/04/2005',
startDay: 1
})
}

This does not work. API is about datapicker, but this is datefield.. how can i apply startDay in this case?

tellioglu
25 Nov 2007, 6:27 AM
I also need the week to begin on monday but couldn't find anything in the API doc about setting startDay for a DateField. I found this though:

http://extjs.com/forum/showthread.php?t=13609

The question has been asked before, with the same confusing answers:

http://extjs.com/forum/showthread.php?t=4948

tryanDLS
25 Nov 2007, 8:31 AM
@banesto - If you ask what you mean, you will likely get a better answer. Your question specifically says 'datapicker'. Did you read the other thread and do what Jack recommended?

banesto
25 Nov 2007, 9:33 AM
yeah, i mixed that up, because tool for picking dates sounds like datepicker :) anyways, Jack's advice did the trick! Thanks!