PDA

View Full Version : Having trouble with ext js


oregon_sv
05-28-2008, 07:52 PM
:confused: Hello,

i have a grid which show three kinds of data. String, Float, String.
in the database the colums are named like Codigo,CostoUni,Usuario.
and those has the values 002 ,1.23, john
but in the grid values show 2 insted of '002'
the costoUni value its show good.
but in the usuario fields when it has a number value it shows the data but when the value is a string like 'jonh' it says :
char : 2
error : 'jonh' is undefined
code : 0

the code is below:



function main() {
// 1. Create some dummy data data
var sampleData = [
[<?php do {?>],
[<?php echo $linea['codigo']?>,<?php echo $linea['costouni']?>,<?php echo $linea['usuario']?>],
[<?php }while ($linea =@mysql_fetch_array($result)) ?>]
];
// 2. Create the Store
var store = new Ext.data.SimpleStore({
fields : [
{ name: 'codigo', type: 'string' },
{ name: 'costouni', type: 'float' },
{ name: 'usuario', type: 'string' }
],
data: sampleData
});

// 3. Initialize the grid control
var simpleGrid = new Ext.grid.EditorGridPanel({
store: store,
columns: [{
header: 'Codigo', // 4. Field cannot be edited.
width: 70,
sortable: false,
dataIndex: 'codigo'
},
{
header: 'Costo Unitario', // 5. Field can be edited
width: 70,
sortable: false,
dataIndex: 'costouni'
},
{
header: 'Usuario', // 4. Field cannot be edited.
width: 70,
sortable: false,
dataIndex: 'usuario'
}
],
clicksToEdit: 1,
stripeRows: true,
autoHeight:false,
height:300,
width:500,
enableHdMenu: false, // 7. Disable the context menu
title:'Editor Grid OREGONSV',
renderTo: 'formDiv'
});


Can you help me please,

Atte,

Alberto Orellana,
http://www.oregonsv.pcriot.com/es/cwdefault.html (http://www.oregonsv.pcriot.com/es/cwdefault.html)http://extjs.com/forum/images/smilies/1.gif
http://extjs.com/forum/images/misc/progress.gif

davidj
05-28-2008, 08:32 PM
im playing with this framework myself

it seems that your app is having trouble with...

type: 'string'

it may default to string so try to omit the type decleration...

type: ''

oregon_sv
05-28-2008, 08:59 PM
i tried, but it does not work,

this is the original code. and its works.
function main() {
// 1. Create some dummy data data
var sampleData = [
[ 'Bob', 100, <?php echo $lineactualiza['valoruni']?> ],
[ 'Bill', 200, 12.92],
[ 'Mike', 300, 23.02]
];
// 2. Create the Store
var store = new Ext.data.SimpleStore({
fields : [
{ name: 'name', type: 'string' },
{ name: 'hours', type: 'int' },
{ name: 'rate', type: 'float' },
{ name: 'cost', type: 'float' }
],
data: sampleData
});

but i tried to show the data from the data base and i cant.

thank u

davidj
05-28-2008, 09:54 PM
i have to bow out as i am just a nubee with this framework

i will have a look at the weekend if you dont get it sorted

if you sort it post the resolution