Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18/05/2011, 19:33
Avatar de livemusic
livemusic
 
Fecha de Ingreso: abril-2011
Ubicación: Lima - Chorrillos
Mensajes: 150
Antigüedad: 13 años
Puntos: 18
Exclamación Cargar tabla via JSON

Plugin Pivot table: http://metalogic.dk/jquery.pivot/demo.htm

Hola, alguien me podría ayudar, necesito cargar un pivot table, obteniendo lo valores de la base de datos.
Aca tengo un ejemplo sin base de datos. http://maximavirtual.comuf.com/pivot/
El codigo es el siguiente..

Código HTML:
var example4AsJSONdata = {
    dataid: "An optional sourcetable identifier",
    columns: [
        { colvalue: "Month ", coltext: "Month ", header: "Month ", sortbycol: "Month ", groupbyrank: null, pivot: true, result: false },
        { colvalue: "Subject ", coltext: "Subject ", header: "Subject ", sortbycol: "Subject ", groupbyrank: 2, pivot: false, result: false },
        { colvalue: "Student ", coltext: "Student ", header: "Student ", sortbycol: "Student ", dataid: "An optional id.", groupbyrank: 1, pivot: false, result: false },
        { colvalue: "Score ", coltext: "Score ", header: "Score ", sortbycol: "Score ", groupbyrank: null, pivot: false, result: true}],
    rows: [
        { "Month ": "January", "Subject ": "English", "Student ": "Elisa", "Score ": "8.7" },
        { "Month ": "January ", "Subject ": "Maths ", "Student ": "Elisa ", "Score ": "6.5 " },
        { "Month ": "January ", "Subject ": "Science ", "Student ": "Elisa ", "Score ": "5.8 " },
        { "Month ": "March ", "Subject ": "History ", "Student ": "Mary ", "Score ": "6.7 " },
        { "Month ": "March ", "Subject ": "French ", "Student ": "Mary ", "Score ": "9.0 "}]
};

$('#res').pivot({
	source: example4AsJSONdata,
	formatFunc: function (n) { return jQuery.fn.pivot.formatUK(n, 2); },
});

Basicamente los valores que necesito cargar, es el.


Cita:
rows: [
{ "Month ": "January", "Subject ": "English", "Student ": "Elisa", "Score ": "8.7" }]
Pero cuando le incluyo un for, me manda un error, como podria cargar los valores??, espero su pronta ayuda...

Última edición por livemusic; 18/05/2011 a las 21:50