I'm new to YUI. What is the model for talking with a datatable
I'm new to YUI. What is the model for doing the following things
a) Every time I select a row in the datatable, what is the best way to update various UI components on the screen? I know the event listeners have something to do with this... but I'm actually not sure how to do this as the examples only register with itself. I've tried various things, and they don't fire.
How do I add extra columns to the datatable for custom data? For example, I'd like to put links for editing, deleting, viewing, etc. the information contained in that row. Sometimes a link will only appear if the state of the object is a value. Like, if( object.isDisabled) showEnableLink(). Is this possible? (I hope so)
c) Based on actions outside of the datatable, how do I tell the datatable to refresh itself? Let's say a delete link is clinked, which removes one of the rows in the datatable. How do I tell the datatable to re-query the datasource to refresh itself?
Okay, I realized that in order to get feedback on the selected row, I had to add two events... the default event from the datatable as well as my own. My current thinking was overriding the current even and the select css settings would still exist, but that got rid of them. Then my next line of thinking was that I could call the parent/super implementation before I did my own thing. That didn't work though. I wasn't understanding that there was a list of subscribers for the same component.
Anyhoo, now that this is working, I still need help with adding html/code to various columns in addition to the json that I'm pulling from. I also need to refresh the table when something like happens.
Okay, I figured out how to refresh. I wish it was a simple as .refresh()... the methods are there and they don't do anything. They have refreshData() and refreshView()... methods I would expect to do what they say... yet they don't.
The solution was to ask the datasource to send another request, and then have a callback ask the datatable to initialize the table. I honestly think the data table could do this on its own without me telling it to do it. A simple refreshFromDatasource() method could have done all of this for me. None of this is application-specific behaviour. This is boilerplate... and writing boilerplate sucks.
The last thing I need to accomplish is to add columns and have some kind of a scripting capability to add html and do logic inside of the cells. Suggestions on where to go?