On Wednesday, February 29, 2012 8:40:53 PM UTC+1, superruzafa wrote:
>
> Really thanks for the replies :) 
>
> After reading that and other great posts I still can't work properly 
> with tables :( So let me explain better: 
>
> I could show some values in tabular form, but not in the way I 
> expected. It's seems that the proper way to show these data is not 
> very intuitive (at least for me). 
>
You should pass in more "tabular" data e.g. an array of rows. See example:

    var obj = [
        {name: "John", age: "25"},
        {name: "Jack", age: "24"},
        {name: "Bob", age: "23"}
    ];

If no columns are provided table Rep will get the first row and generate 
default columns.
Code :

var columns = TableRep.computeColumns(obj);
TableRep.columns = columns;
var object = {data: obj, columns: columns};
TableRep.tag.replace({object: object}, this.panelNode);

Or you can change column by providing a column description:

        var cols = [
            { label: "First Name", property: "name" },
            { label: "Age", property: "age" },
        ];

var columns = TableRep.computeColumns(obj, cols); // cols passed in
TableRep.columns = columns;
var object = {data: obj, columns: columns};
TableRep.tag.replace({object: object}, this.panelNode);

Or you can pass  an object into the method:

    var obj =
    {
        row1: {name: "john", age: 25},
        row2: {name: "jack", age: 24},
        row3: {name: "bob", age: 23},
    }

Then TableRep will again try - to get a tabular data from it.

Honza

-- 
You received this message because you are subscribed to the Google
Groups "Firebug" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
https://groups.google.com/forum/#!forum/firebug

Reply via email to