Yes and no. First, avoid anything that starts with an underscore. Those
the underscore is a convention for the user to know that such interface is
discouraged (support or backward compatibility for it may eventually be
dropped). Use, instead:
myDataTable.get('sortedBy').key // there is a set() method as well
These methods are inherited from Element, that's why you won't find them in
the index for DataTable.
Second, you don't need to do it twice. sortColumn reverses the sort order
it believes it has (it simply serves the event of clicking a column header)
so you can first make it believe the order is the opposite of what it
actually has by reversing the 'dir' property of sortedBy and then doing a
single sort. You can also wait the few weeks it will take for the new
version which should have the second argument for sortColumn.
Otherwise, what you suggest will work.
----- Original Message -----
From: "msapunov" <msapunov@...>
Sent: Monday, February 04, 2008 2:54 PM
> So, technically, i have to get the sorted column name (via
> myDataTable._configs.sortedBy.value.key) and apply the
> myDataTable.sortColumn() method twice, am i right?
>> New rows are added to the DataTable where the index says and, if
> none, at
>> the end, regardless of how or whether it is sorted. The sortedBy
>> configuration attribute only helps in highlighting the right column and
>> keeping it highlighted when the table is refreshed, but it does not
>> the data, existing or new. You can actually set sortedBy on
> unsorted data
>> and the DataTable won't notice.
>> You have three choices: let the user re-sort the data (highlighting
>> added rows might help the user know that it is meant to work like
>> You can use method sortColumn to resort the data and, finally, you
> can do a
>> binary search on the existing data and find the index of the
> position to
>> insert it in.
>> The easiest is to use sortColumn to resort the data, since all
> except one
>> record is already sorted, it shouldn't waste much time at all.
>> Right now, sortColumn only takes one argument, the column to be
> sorted but
>> does not take whether ascending or descending. If you call
> sortColumn on
>> the column which is currently sorted, it will reverse. Adding a
>> argument has been requested and should be available in next version
> soon to
>> be released.
>> ----- Original Message -----
>> From: "msapunov" <msapunov@...>
>> Sent: Monday, February 04, 2008 12:51 PM
>> > Hi!
>> > I have question about client side sorting inside DataTable. So, i have
>> > a DataTable and time to time i have to put a new data in it using
>> > initializeTable method(could be some other methods but i find out that
>> > only this one is suitable for me). But, in this case i have a
>> > predictable glitch concerning with sorting issue. Despite of previous
>> > sorting, the table start to fill with data's in their turn order. So,
>> > how could i fill the table keeping previous sorting intact? Is the
>> > only option to sort new data's manually? If this question is already
>> > discussed fill free to point me on it :)
>> > Cheers.
>> > Yahoo! Groups Links
>> > --
>> > No virus found in this incoming message.
>> > Checked by AVG Free Edition.
>> > Version: 7.5.516 / Virus Database: 269.19.19/1257 - Release Date:
>> > 03/02/2008 17:49
> Yahoo! Groups Links
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.516 / Virus Database: 269.19.19/1257 - Release Date:
> 03/02/2008 17:49