[Fxruby-users] Sorting a FXTable
Status: Inactive
Brought to you by:
lyle
|
From: Jamey C. <jc...@tw...> - 2004-03-11 22:06:11
|
I must be crazy. After Lyle answered my question about sorting a FXIconList, I spent the next few days coding my app using the IconList. I got it all done. It looks good. It's responsive. So what do I do, I start messing around with FXTable, because, even though IconList works, I would REALLY love to have grid lines, alternating row background colors, and column justification in my listviews. So, I couldn't leave well enough alone. I'm thinking about ripping the IconLists out of my app and replacing them with Tables. I've got most of the functionality I need working for the Table, but I have (again) come upon the sorting issue. FXTable has a sort and a sort_by method. Using Lyle's IconList example as a starting point, I started messing around with the sort method. I overrode the FXTableItem's <=> method, but I ran into my first problem. Whereas the sortItems method in IconList was using the entire tab-delimited row, it was easy for me to split the row into an array and specify the column I wanted to sort on by using an index to the array. However, since the TableItem represents only one cell, it seems to be defaulting to the first column of the Table. I'm stumped as to how to get it to sort by another column. Also, although the sort method does call the TableItem's <=> method, and the <=> method does return a -1, 0, or 1 based on the current value and the argument's value, it does not appear to be actually producing a table sorted on the first row. What I mean is, even though I can see the sort method actually running and calling <=> for each cell in column 0, the table is not resorted after the method finishes. So that's my question with the sort method of FXTable. I also looked at the sort_by method. It appears that the sort_by method is looking for a code block that it will pass an entire row of cells to. For a while, I thought I had found what I needed. But I'm not sure what I'm supposed to put in this code block. Anyway, any light shed upon FXTable sorting would be greatly appreciated! Jamey Cribbs Confidentiality Notice: This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and/or privileged information. If you are not the intended recipient(s), you are hereby notified that any dissemination, unauthorized review, use, disclosure or distribution of this email and any materials contained in any attachments is prohibited. If you receive this message in error, or are not the intended recipient(s), please immediately notify the sender by email and destroy all copies of the original message, including attachments. |