Feature Request: Extensible DOM selectors for different HTML

Feature Request: Extensible DOM selectors for different HTML

hdonhdon Posts: 1Questions: 0Answers: 0
edited November 2010 in Bug reports
Hi all :)

I am using the excellent Constellation suite for all my GUI needs on the current project I am working on. It provides some great HTML, CSS, and Javascript (using jQuery) to get me started.

My problem is that I'd like to use Datatables, but I'd also like to display my data with a different layout than what is offered by tables.

An HTML table element is pretty much rows and columns. That's all you get, and for any of you who come from the 90's when entire websites were laid out using you know this is what TABLE is for.

But I am not as concerned with rows and columns as much as I am concerned with tables in my database and the records I want to show.

So I re-read the datatables documentation, and then I read the datatables source code. What I learned is that many things are hard-coded, for instance I see this in a lot of places:

[code]something.getElementsByTagName("TABLE")[/code]

Datatables is hard-coded to only acknowledge TABLE, THEAD, TFOOT, TR, and TD pretty much.

I would like some Datatables expert to advise me on how to move forward:

It seems to me that it would be trivial to replace the hard-coded parts with custom jQuery selectors, or even arbitrary DOM selector functions. In my case it looks like this:

[code]
/* The way datatables works now */
table = $('table')
header = table.children('thead')
records = table.children('tr')
values = records.children('td')

/* The way I would like to work with Constellation */
table = $('ul.grid')
header = table.children('.header')
records = table.children('li')
values = records.children('p')
[/code]

I probably don't have the time to extend datatables myself, but it seems like it shouldn't be too hard. You could provide a function for rendering a table, headers or footers, records, modifying values, etc.

Maybe something like this is already being worked on?

Thanks for any feedback :)
This discussion has been closed.