|
List Info
Thread: Re: datatable tbody expand/collapse
|
|
| Re: datatable tbody expand/collapse |
  United States |
2007-10-23 23:10:34 |
|
Thank you Satyam! I was wondering how to display only the column headers; I didn't know you could return an array of no records to achieve this. I also have: var myColumnDefs = [ {key:"longdesc", label:"<img class='expacoll' src='expand.gif' onclick='loaddata()'> temp desc", className:"longdesc"}, ... ]
and a loaddata() function that populates my datatable:
function loaddata(evt) { myDataSource.sendRequest("attr=val", myDataTable.onDataReturnInitializeTable, myDataTable); // myDataSource.sendRequest("attr=val", myDataTable.onDataReturnAppendRows, myDataTable); }
Is there a correct way to add an image
in the column header? I'm pretty sure that way I'm doing it now is not right...
----- Original Message ---- From: Satyam <satyam satyam.com.ar> To: ydn-javascript yahoogroups.com Sent: Tuesday, October 23, 2007 5:27:00 PM Subject: Re: [ydn-javascript] datatable tbody expand/collapse
Ok, I wasn't sure what was it you wanted. I
guess you could load the table giving the DataSource an URL that will return no
records. You can change the contents of the MSG_EMPTY variable so it will
show something else. Actually, rather than changing the URL, use the
initialRequest configuration parameter, something to signal the server to return
no records. This will show the headings and whatever text you put into the
MSG_EMPTY string (which can have HTML tags in it, such as an <img>, a
<div> with text or a button). You can hook a listener to that
element when tableMsgShowEvent which is fired right after the message (with
the clickable element) is shown to the user.
Then when you actually want to show the actual
data, change the MSG_EMTPY text to the real message (this won't change whatever
is shown in the table but will show the right message should the table actually
be empty the next time) and load the real data on the table. This you
can do via a function such as requery, suggested in the Feature
Request:
Remember to remove the listener to the element you
put into MSG_EMPTY before the requery since the element will dissapear
(initially it will simply be hidden but eventually it will be
replaced
Hope it works
Satyam
----- Original Message -----
Sent: Tuesday, October 23, 2007 9:51
PM
Subject: Re: [ydn-javascript] datatable
tbody expand/collapse
Hi
Satyam, what I'm looking for is for the tbody section to be initially hidden;
then when I click the thead section (an expand/col lapse icon in the thead
section, or if I cannot put an img in the thead sectoin, perhaps outside of
the table but right next to the thead section), the tbody section
expands/collapses.
I did see your post about the floating panel but
that wasn't quite what I was looking for...
-----
Original Message ---- From: Satyam <satyam satyam. com.ar> To:
ydn-javascript yahoogroups. com Sent: Tuesday, October 23, 2007 3:12:28
AM Subject: Re: [ydn-javascript] datatable tbody expand/collapse
There is nothing built-in to support that. Actually, I'm not sure what is
it precisely what you are looking for, but what I am sure is that the
DataTable, as it is, does not expand/collapse in any way, what it has to
show, it shows at once.
Some time ago someone asked for a row
containing header information to have detailed information listed
underneath . This was done by simply manipulating the HTML table element,
reading the current row location, adding a row with a single cell with a
colspan spanning all the table and then putting anything you want in that
single cell, even another DataTable. That expanded row is volatile, since
the DataTable knows nothing about it, any refresh of the DataTable, such
as a sort or moving around with clien-side pagination will wipe out the
expansion.
This is somewhat dangerous: the extra rows will go but it
will leave behind a lot of event listeners and extra hidden elements that
DataTable creates to support the inner DataTable. Though the DataTable has
a destroy() method, JavaScript knows nothing about object destructors so
it never calls it by itself so you would have to listen to all events that
might signal a table refresh to destroy the child DataTables you might
have created.
What I use instead is a single floating YUI panel which I
position right under the row to be expanded and move around as needed. It
actually has a YUI tabview, 3 of the tabs with DataTables, another with
free-flow text. The DataTables and the tabs are never destroyed and
recreated, simply refreshed with new information for each record. Thus, no
garbage gets left behind. I still have to listen to any event that might
refresh the table to hide the panel but if I forget something (and I did),
the user can simply close it as he would normally do, nothing gets
broken.
Satyam
----- Original Message ----- From:
"shortestpath" <shortestpath
yahoo.com> To: <ydn-javascript yahoogroups.
com> Sent: Tuesday, October 23, 2007 5:16 AM Subject:
[ydn-javascript] datatable tbody expand/collapse
> looked a bit
through the posts but I haven't found an answer yet - > does datatable
support expand/collapse (preferably accordion-style) of > the tbody
section only? > > > > > Yahoo! Groups
Links > > > > > > -- > No virus
found in this incoming message. > Checked by AVG Free Edition. >
Version: 7.5.488 / Virus Database: 269.15.5/1084 - Release Date: >
21/10/2007 15:09 > >
____________ _________ _________ _________ _________ __ Do
You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around
http://mail. yahoo.com
No virus found in this incoming message. Checked by AVG Free
Edition. Version: 7.5.503 / Virus Database: 269.15.6/1086 - Release Date:
22/10/2007 19:57
________ __________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
__._,_.___
.
__,_._,___
|
| Re: datatable tbody expand/collapse |
  Spain |
2007-10-24 05:40:37 |
|
Now that I think of it, I was assuming you wanted
to delay the actual loading of data, not just simply hide the contents. If
so, you might be better just hiding and showing the table body.
For example, to hide it, you may subscribe to the
refreshEvent element and do like this:
myDataTable.subscribe('refreshEvent',function()
{ this.getTbodyEl().style.display
='none'; this.unsubscribe('refreshEvent');
//you don't want further firing of the event to hide the table
again. });
and then some element to show it:
YAHOO.util.Dom.Event.on(showTable','click',
function()
{ myDataTable.getTbodyEl().style.display=''; });
----- Original Message -----
Sent: Wednesday, October 24, 2007 6:10
AM
Subject: Re: [ydn-javascript] datatable
tbody expand/collapse
Thank
you Satyam! I was wondering how to display only the column headers; I didn't
know you could return an array of no records to achieve this. I also
have: var myColumnDefs = [ {key:"longdesc",
label:"<img class='expacoll' src='expand.gif' onclick='loaddata()'> temp
desc", className:"longdesc"}, ... ]
and a
loaddata() function that populates my datatable:
function loaddata(evt)
{ myDataSource.sendRequest("attr=val",
myDataTable.onDataReturnInitializeTable, myDataTable);
// myDataSource.sendRequest("attr=val", myDataTable.onDataReturnAppendRows,
myDataTable); }
Is there a correct way to add an image in the
column header? I'm pretty sure that way I'm doing it now is not
right...
-----
Original Message ---- From: Satyam <satyam satyam.com.ar> To:
ydn-javascript yahoogroups.com Sent: Tuesday, October 23, 2007 5:27:00
PM Subject: Re: [ydn-javascript] datatable tbody expand/collapse
Ok, I wasn't sure what was it you wanted. I
guess you could load the table giving the DataSource an URL that will return
no records. You can change the contents of the MSG_EMPTY variable so it
will show something else. Actually, rather than changing the URL, use
the initialRequest configuration parameter, something to signal the server to
return no records. This will show the headings and whatever text you put
into the MSG_EMPTY string (which can have HTML tags in it, such as an
<img>, a <div> with text or a button). You can hook a
listener to that element when tableMsgShowEvent which is fired right
after the message (with the clickable element) is shown to the
user.
Then when you actually want to show the actual
data, change the MSG_EMTPY text to the real message (this won't change
whatever is shown in the table but will show the right message should the
table actually be empty the next time) and load the real data on the
table. This you can do via a function such as requery, suggested in the
Feature Request:
Remember to remove the listener to the element
you put into MSG_EMPTY before the requery since the element will dissapear
(initially it will simply be hidden but eventually it will be
replaced
Hope it works
Satyam
----- Original Message -----
Sent:
Tuesday, October 23, 2007 9:51 PM
Subject:
Re: [ydn-javascript] datatable tbody expand/collapse
Hi
Satyam, what I'm looking for is for the tbody section to be initially
hidden; then when I click the thead section (an expand/col lapse icon in the
thead section, or if I cannot put an img in the thead sectoin, perhaps
outside of the table but right next to the thead section), the tbody section
expands/collapses.
I did see your post about the floating panel but
that wasn't quite what I was looking for...
-----
Original Message ---- From: Satyam <satyam satyam. com.ar> To:
ydn-javascript yahoogroups. com Sent: Tuesday, October 23, 2007 3:12:28
AM Subject: Re: [ydn-javascript] datatable tbody expand/collapse
There is nothing built-in to support that. Actually, I'm not sure what is
it precisely what you are looking for, but what I am sure is that the
DataTable, as it is, does not expand/collapse in any way, what it has to
show, it shows at once.
Some time ago someone asked for a row
containing header information to have detailed information listed
underneath . This was done by simply manipulating the HTML table
element, reading the current row location, adding a row with a single
cell with a colspan spanning all the table and then putting anything you
want in that single cell, even another DataTable. That expanded row is
volatile, since the DataTable knows nothing about it, any refresh of the
DataTable, such as a sort or moving around with clien-side pagination
will wipe out the expansion.
This is somewhat dangerous: the extra
rows will go but it will leave behind a lot of event listeners and extra
hidden elements that DataTable creates to support the inner DataTable.
Though the DataTable has a destroy() method, JavaScript knows nothing
about object destructors so it never calls it by itself so you would
have to listen to all events that might signal a table refresh to
destroy the child DataTables you might have created.
What I use
instead is a single floating YUI panel which I position right under the
row to be expanded and move around as needed. It actually has a YUI
tabview, 3 of the tabs with DataTables, another with free-flow text. The
DataTables and the tabs are never destroyed and recreated, simply
refreshed with new information for each record. Thus, no garbage gets
left behind. I still have to listen to any event that might refresh the
table to hide the panel but if I forget something (and I did), the user
can simply close it as he would normally do, nothing gets
broken.
Satyam
----- Original Message ----- From:
"shortestpath" < shortestpath%40yahoo.com" target="_blank" rel="nofollow" ymailto="mailto:shortestpath%40yahoo.com">shortestpath
yahoo.com> To: < ydn-javascript%40yahoogroups.com" target="_blank" rel="nofollow" ymailto="mailto:ydn-javascript%40yahoogroups.com">ydn-javascript
yahoogroups. com> Sent: Tuesday, October 23, 2007 5:16
AM Subject: [ydn-javascript] datatable tbody expand/collapse
>
looked a bit through the posts but I haven't found an answer yet - >
does datatable support expand/collapse (preferably accordion-style)
of > the tbody section only? > > > > >
Yahoo! Groups Links > > > > > > --
> No virus found in this incoming message. > Checked by AVG
Free Edition. > Version: 7.5.488 / Virus Database: 269.15.5/1084 -
Release Date: > 21/10/2007 15:09 > >
____________ _________ _________
_________ _________ __ Do You Yahoo!? Tired of spam? Yahoo! Mail has
the best spam protection around http://mail. yahoo.com
No virus found in this incoming message. Checked by AVG Free
Edition. Version: 7.5.503 / Virus Database: 269.15.6/1086 - Release
Date: 22/10/2007
19:57
__________________________________________________ Do
You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
No virus found in this incoming message. Checked by AVG Free
Edition. Version: 7.5.503 / Virus Database: 269.15.6/1086 - Release Date:
22/10/2007 19:57
__._,_.___
.
__,_._,___
|
[1-2]
|
|