[Webkit-unassigned] [Bug 38664] Web Inspector: add a "table" method to console, to allow output of tabular data

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon May 31 03:19:18 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=38664





--- Comment #10 from Jan Odvarko <odvarko at gmail.com>  2010-05-31 03:19:16 PST ---
(In reply to comment #8)
> (In reply to comment #7)
> > What do you think?
> 
> I'm not a big fan of overridden parameters, and it looks like this is getting a bit out of control!  :-)
> 
> How about we get rid of the ability to output multiple tables - you can already get nesting/grouping via group()/endGroup().
> 
> And then take an optional 2nd parameter which is an options object, with a property per option.  So you could do the column headers via something like this:
> 
>     console.table(array2D, { columns: ["first", "second", "third"]})
> 
> maybe support row headers:
> 
>     console.table(array2D, { rows: ["first row", "second row", "third row"]})
> 
> leaves lots of space for additional options - table width (100% or sized-to-fit), cellpadding, etc
OK, you are right, let's specify the column header via an additional parameter and avoid support for multiple arguments.

So, using your example, following would log a table with three provided columns:
console.table(array2D, { columns: ["first", "second", "third"]});

And the following example would log a table, where columns are dynamically gathered from the first row of provided data (so header is expected to be part of the data):
console.table(array2D);

What I still like is a way to optionally provide a label for the log i.e.:
console.table("My table", array2D);

I tend to believe that this will be actually the most useful scenario. The user just logs a table (collapsed by default so, it doesn't take so much space in the console) and the only visible thing is the label (with a toggle button). In case where the title is not specified the table is directly visible, which can be also useful (mainly if the table is rather small).

Other option is to have the 'label' parameter mandatory, but then we loose the simplicity in case the user wants to write just: console.table(array2d);

Would this work for you?

---

As far as the options object is concerned, do you think the user could also specify sort type for a column? Firebug is now using either alphabetical or numerical sort that dynamically applies according to the actual data type in the second row (first is the header now). 

E.g. something like:
console.table(array2D, { columns: [{label: "first", sort: "alpha"}, "second", "third"]});
- the first column would explicitly use alphabetical sorting regardless of actual data type in the column.

Honza

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list