0

Datatable Interface Observation / Suggestion

Hey all,

I just recently completed my first implementation of a Datatable. I needed to get the data from a row and I'd read in the documentation that I'd need to use getSelectedRows. I didn't read it well enough and was surprised by what this returned which was an array of the rowIDs. I then learned that I had to use a second function getRecord and send it the rowID and finally call getData to get the data I wanted.

A co-worker and I were debating over why it was set up this way. Flexibility comes to my mind first off which is great. But the question I have is in addition to these functions why is there not a member function for the Datatable itself that would allow you to retrieve the selected records such as a getSelectedRecords function. Of course this is easy for us to create ourselves but just from a design point of view I was curious as to why a function such as that wasn't considered to be part of the Datatable's interface.

To me getting the data from a row should be one of the main services that object provides. I likened it to creating a player object but leaving out the play button but providing functions that allowed you to create your own play button.

But as for my suggestions, I think the function getSelectedRows should really be called getSelectedRowIds to better reflect it's purpose. Granted I didn't read as well as I should have but when I saw getSelectedRows I automatically thought it would return an array of Records that I could then extract my data from.

by
0 Replies
  • Hi stormblade31,

    Thank you for the suggestion. Are you referencing the YUI DataTable utility (http://developer.yahoo.com/yui/datatable/)? If so, you may also want to post to the JavaScript discussion group at http://tech.groups.yahoo.com/group/ydn-javascript/ as it is a discussion group for the YUI library.

    - Jon

    QUOTE (stormblade31 @ May 16 2009, 06:15 AM) <{POST_SNAPBACK}>
    Hey all,

    I just recently completed my first implementation of a Datatable. I needed to get the data from a row and I'd read in the documentation that I'd need to use getSelectedRows. I didn't read it well enough and was surprised by what this returned which was an array of the rowIDs. I then learned that I had to use a second function getRecord and send it the rowID and finally call getData to get the data I wanted.

    A co-worker and I were debating over why it was set up this way. Flexibility comes to my mind first off which is great. But the question I have is in addition to these functions why is there not a member function for the Datatable itself that would allow you to retrieve the selected records such as a getSelectedRecords function. Of course this is easy for us to create ourselves but just from a design point of view I was curious as to why a function such as that wasn't considered to be part of the Datatable's interface.

    To me getting the data from a row should be one of the main services that object provides. I likened it to creating a player object but leaving out the play button but providing functions that allowed you to create your own play button.

    But as for my suggestions, I think the function getSelectedRows should really be called getSelectedRowIds to better reflect it's purpose. Granted I didn't read as well as I should have but when I saw getSelectedRows I automatically thought it would return an array of Records that I could then extract my data from.
    0

Recent Posts

in Suggestions for YDN