Search the web
Sign In
New User? Sign Up
ydn-javascript · Yahoo! User Interface Library Group
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want to share photos of your group with the world? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Nested headers in Data Table   Message List  
Reply | Forward Message #36440 of 52127 |
Re: Nested headers in Data Table

the caption is not generated in response to a DataSource query. It is
just a configurable string. You can, however, subscribe to the
dataReturnEvent with a function that updates the caption attribute
accordingly.

Luke

--- In ydn-javascript@yahoogroups.com, "info2hussain"
<info2hussain@...> wrote:
>
>
> Hi Luke,
>
> Thanks for your reply. I'm sorry to hear that DataTable doesn't support
> this. Let me explain you my intention. I have a 'div' element and I want
> to put all my information in that div. Now if any user clicks on the
> 'value' column under the 'slots' column then a pop-up window will appear
> and will show some more specific information about that clicked value.
> As a result, I must need to have the child column headers Name and
> Values. I have another idea in my mind now. That is drawing a YUI data
> table based on the 'slots' part of the JSON data and putting the other
> information as caption of the table like the following :
>
>
>
>
>
>
"name":"http://www.ip-super.org/ontologies/execution-history#instant5953\
> 524",
>
> "homeOntology":"EXECUTION-HISTORY",
>
> "class":"TIME:TimeInstant",
>
> "documentation":null,
>
> "slots":
>
> Name
>
> Values
>
> TIME:yearOf
>
>
>
> 2008
>
> TIME:monthOf
>
>
>
> 5
>
> TIME:dayOf
>
> 12
>
>
>
>
> I tried to use the 'caption' property of the data table to put the
> "name", "homeOntology", "class", "documentation" on top of the able but
> could not succeeded.
>
> My codes are like below now:
>
>
> function showProcessList(){
>
> Processes = {
>
>
"name":"http://www.ip-super.org/ontologies/execution-history#instant5953\
> 524",
> "homeOntology":"EXECUTION-HISTORY",
> "class":"TIME:TimeInstant",
> "documentation":null,
> "slots":[
>
> {"name":"TIME:yearOf","values":["2008"]},
> {"name":"TIME:monthOf","values":["5"]},
> {"name":"TIME:dayOf","values":["12"]},
> {"name":"TIME:hourOf","values":["10"]},
>
> {"name":"TIME:minuteOf","values":["46"]},
>
> {"name":"TIME:secondOf","values":["56"]},
>
> {"name":"TIME:millisecondOf","values":["951"]},
>
> {"name":"TIME:microsecondOf","values":["0"]},
> {"name":"HAS-PRETTY-NAME","values":[]}
> ]
> };
>
>
> var myColumnDefs = [
> {key:"name",sortable:true, label:"Name"},
> {key:"values",sortable:true, label:"Values"},
>
> ];
>
>
>
>
> var myDataSource = new
YAHOO.util.DataSource(Processes);
>
> myDataSource.responseType =
> YAHOO.util.DataSource.TYPE_JSON;
>
>
> myDataSource.responseSchema = {
> resultsList : 'slots',
> fields: ["name","values"],
> metaFields: {
> Class:"class",
> HomeOntology:"homeOntology"
> }
> };
>
> // Instantiate right away...
> var myDataTable = new
> YAHOO.widget.DataTable("myContainer", myColumnDefs,
> myDataSource,{caption:myDataSource.name + "\n" + myDataSource.class +
> "\n" + myDataSource.homeOntology + "\n" + "slots:"});
>
> }
>
>
> Would you please be kind enough to test my code and let me know what I'm
> doing wrong here. I am also wondering if it is possible to show YUI's
> DataSource 'metaFields' in browser. If it is possible to show that then
> instead of using caption property, I can use that 'metaFields' things.
>
> Thanks for your cooperation.
>
> Hussain
>
>
> --- In ydn-javascript@yahoogroups.com, "Lucas Smith" <lsmith@> wrote:
> >
> > Hussain,
> >
> > DataTable does not support that sort of table structure.
> >
> > However, if you didn't mind losing the child column headers Name and
> > Values, it would be possible to use a custom formatter in the Slots
> > column to (I can't believe I'm suggesting this) create a nested table
> > in each cell of that column.
> >
> > The DataSource/DataTable config would look something like this:
> > myDataSource.responseSchema = {
> > ...
> > fields : ["name","homeOntology","class","documentation","slots"],
> > ...
> > };
> >
> > myColumnDefs = [
> > ...
> > {key:"slots",label:"Slots",formatter: function (cell,rec,col,data)
> {
> > // Create a table DOM structure from the array of objects
> > stored in data
> > var slotsTable = document.createElement('table'),
> > tbody =
> > slotsTable.appendChild(document.createElement('tbody')),
> > tr,td,i;
> > // loop through data and append a new row into tbody for each
> > ...
> >
> > cell.appendChild(slotsTable);
> > }},
> > ...
> > ];
> >
> > Of course, whether something like this will work for you depends on
> > what sort of interactivity you want your table to support. If you
> > just want a nice looking table with no particular interaction support
> > (no sorting, scrolling, paginating, etc), you might be better off just
> > building the entire table from scratch in response to a Connection
> > Manager request.
> >
> > Hope this helps,
> > Luke
> > --- In ydn-javascript@yahoogroups.com, "info2hussain"
> > info2hussain@ wrote:
> > >
> > > Hi Luke,
> > >
> > > I have drawn a table below and my desired out put should be like
> that.
> > >
> > >
> > >
> > >
> > > name
> > >
> > > homeOntology
> > >
> > > class
> > >
> > > documentation
> > >
> > > slots
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > name
> > >
> > > Values
> > >
> > >
> > >
> > >
> > > http://www.ip-super.org/ontologies/execution-history#instant5953524
> > >
> > > EXECUTION-HISTORY
> > >
> > > TIME:TimeInstant
> > >
> > > null
> > >
> > > TIME:yearOf
> > >
> > > 2008
> > >
> > > TIME:monthOf
> > >
> > > 5
> > >
> > > TIME:dayOf
> > >
> > > 12
> > >
> > > TIME:hourOf
> > >
> > > 10
> > >
> > > TIME:minuteOf
> > >
> > > 46
> > >
> > > TIME:secondOf
> > >
> > > 56
> > >
> > > TIME:millisecondOf
> > >
> > > 951
> > >
> > > TIME:microsecondOf
> > >
> > > 0
> > >
> > > HAS-PRETTY-NAME
> > >
> > >
> > >
> > >
> > >
> > >
> > > For your convenience, the above datatable should be drawn for the
> below
> > > input:
> > >
> > > data= {
> > >
> > >
> >
>
"name":"http://www.ip-super.org/ontologies/execution-history#instant5953\
> \
> > > 524",
> > > "homeOntology":"EXECUTION-HISTORY",
> > > "class":"TIME:TimeInstant",
> > > "documentation":null,
> > > "slots":[
> > >
> > > {"name":"TIME:yearOf","values":["2008"]},
> > >
> {"name":"TIME:monthOf","values":["5"]},
> > >
> {"name":"TIME:dayOf","values":["12"]},
> > >
> {"name":"TIME:hourOf","values":["10"]},
> > >
> > > {"name":"TIME:minuteOf","values":["46"]},
> > >
> > > {"name":"TIME:secondOf","values":["56"]},
> > >
> > > {"name":"TIME:millisecondOf","values":["951"]},
> > >
> > > {"name":"TIME:microsecondOf","values":["0"]},
> > >
> {"name":"HAS-PRETTY-NAME","values":[]}
> > > ]
> > > }
> > >
> > >
> > > Thanks for your cooperation.
> > >
> > >
> > > Thanks,
> > > Hussain
> > >
> > > --- In ydn-javascript@yahoogroups.com, "Lucas Smith" <lsmith@>
> wrote:
> > > >
> > > > --- In ydn-javascript@yahoogroups.com, "info2hussain"
> > > > info2hussain@ wrote:
> > > > >
> > > > > Hi All,
> > > > >
> > > > > I am trying to draw a data table using JSON data. I want to
> include
> > > > > every single peace of the data in the table. As a result, I need
> to
> > > > > create nested headers. I followed the YUI example in
> > > > >
> > >
> http://developer.yahoo.com/yui/examples/datatable/dt_nestedheaders.html
> > > > > but I'm not geting the desired result. I have given my code
> below.
> > > When
> > > > > I run the code, I get a table with all the column I defined. But
> > > only
> > > > > four columns namely
> "name","homeOntology","class","documentation"
> > > show
> > > > > the data and "slots column remain empty". If any one can figure
> out
> > > what
> > > > > I am doing wrong, would be of great favor to me.
> > > > >
> > > > > function drawTable(){
> > > > >
> > > > > data=
> > > > > {
> > > > >
> > > > >
> > > >
> > >
> >
>
"name":"http://www.ip-super.org/ontologies/execution-history#instant5953\
> \
> > > \
> > > > > 524",
> > > > > "homeOntology":"EXECUTION-HISTORY",
> > > > > "class":"TIME:TimeInstant",
> > > > > "documentation":null,
> > > > > "slots":[
> > > > >
> > > > > {"name":"TIME:yearOf","values":["2008"]},
> > > > >
> > > > > {"name":"TIME:monthOf","values":["5"]},
> > > > >
> > > > > {"name":"TIME:dayOf","values":["12"]},
> > > > >
> > > > > {"name":"TIME:hourOf","values":["10"]},
> > > > >
> > > > > {"name":"TIME:minuteOf","values":["46"]},
> > > > >
> > > > > {"name":"TIME:secondOf","values":["56"]},
> > > > >
> > > > > {"name":"TIME:millisecondOf","values":["951"]},
> > > > >
> > > > > {"name":"TIME:microsecondOf","values":["0"]},
> > > > >
> > > > > {"name":"HAS-PRETTY-NAME","values":[]}
> > > > > ]
> > > > > };
> > > > >
> > > > > var myColumnDefs = [
> > > > > {key:"name",sortable:true,
> label:"Name"},
> > > > >
> > > {key:"homeOntology",sortable:true,label:"Home
> > > > > Ontology"},
> > > > > {key:"class",sortable:true,
> label:"Class"},
> > > > > {key:"documentation",sortable:true,
> > > > > label:"Documentation"},
> > > > > {label: "Slots",children:[
> > > > >
> > > > > {key:"slots.name",sortable:true, label:"Name"},
> > > > >
> > > > > {key:"slots.values",sortable:true, label:"Values"},
> > > > > ]}
> > > > >
> > > > >
> > > > > ];
> > > > >
> > > >
> > > > Hussain,
> > > >
> > > > Can you provide an example of what you expect the column headers
> to
> > > > look like?
> > > >
> > > > Luke
> > > >
> > >
> >
>





Thu Aug 21, 2008 12:33 am

y_lsmith
Online Now Online Now
Send Email Send Email

Forward
Message #36440 of 52127 |
Expand Messages Author Sort by Date

Hi All, I am trying to draw a data table using JSON data. I want to include every single peace of the data in the table. As a result, I need to create nested...
info2hussain
Offline Send Email
Aug 19, 2008
5:09 pm

... "name":"http://www.ip-super.org/ontologies/execution-history#instant5953\ ... Hussain, Can you provide an example of what you expect the column headers to ...
Lucas Smith
y_lsmith
Online Now Send Email
Aug 19, 2008
9:18 pm

Hi Luke, I have drawn a table below and my desired out put should be like that. name homeOntology class documentation slots name Values ...
info2hussain
Offline Send Email
Aug 19, 2008
11:39 pm

Hussain, DataTable does not support that sort of table structure. However, if you didn't mind losing the child column headers Name and Values, it would be...
Lucas Smith
y_lsmith
Online Now Send Email
Aug 20, 2008
4:16 pm

Hi Luke, Thanks for your reply. I'm sorry to hear that DataTable doesn't support this. Let me explain you my intention. I have a 'div' element and I want to...
info2hussain
Offline Send Email
Aug 20, 2008
5:32 pm

the caption is not generated in response to a DataSource query. It is just a configurable string. You can, however, subscribe to the dataReturnEvent with a...
Lucas Smith
y_lsmith
Online Now Send Email
Aug 21, 2008
12:33 am

Hi Luke, Thanks for your reply. I'm sorry to hear that DataTable doesn't support this. Let me explain you my intention. I have a 'div' element and I want to...
info2hussain
Offline Send Email
Aug 20, 2008
9:14 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help