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