qyqx / j-table

Automatically exported from code.google.com/p/j-table
0 stars 0 forks source link

enable array-based API #43

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
perhaps columnArray() tableArray() or something.

This will enable an API for end users, e.g. 
   columnB = [x + 1 for x in columnA]

or find duplicates
   [x for x in columnA for y in columnA if x == y]
or whatever the code is. Much better than Excel scripts.

Original issue reported on code.google.com by chris.f....@gmail.com on 2 Oct 2008 at 6:42

GoogleCodeExporter commented 8 years ago
what do I want
*       easy array getters / setters for the table, rows, and columns

table.values() - returns [row][column]
table.column("xyz").values() - returns [row]
table.row("xyz").values() - returns [column]

but what is "xyz", how do you refer to them?
* by number e.g. table.column(1).values() and table.row(2).values()
* by the content in the column / row header. e.g. <th>Heading2</th> would allow
table.column("Heading2").values(). This would rely on a header row and header 
cell in
the first cell of the row.

you could do setters using

table.column("xyz").values([a,b,c]) which would overwrite the first three cells 
in
the column (leaving the others intact)

what would this enable?
table.addColumn().values([i + 1 for i in table.column("old")])

Original comment by chris.f....@gmail.com on 3 Oct 2008 at 10:06

GoogleCodeExporter commented 8 years ago
however this wouldn't enable binding. perhaps I should add an entirely 
symmetrical
function, .bind().

So: table.addColumn().bind([i+1 for i in table.column("old")]);

which would update the new column whenever the "old" column changed its values.

Original comment by chris.f....@gmail.com on 3 Oct 2008 at 10:08

GoogleCodeExporter commented 8 years ago
no, we've got to make it entirely functional from the start.

so we can't have separate bind() functions, binding is "assumed" from the 
values()
function. 

Original comment by chris.f....@gmail.com on 3 Oct 2008 at 10:10

GoogleCodeExporter commented 8 years ago
But surely binding should be implemented for ANY html element, not just table 
ones?
So this should probably be a new library. For example, you can imagine binding 
a set
of <li> elements to another set of <li> elements, this should be allowed using 
the
.values() syntax as well.

Original comment by chris.f....@gmail.com on 4 Oct 2008 at 9:48