I already found a solution..

Here is a widget you can use that will accomplish what you are looking for:

$(function() {
    // add new widget called indexFirstColumn
    $.tablesorter.addWidget({
        // give the widget a id
        id: "indexFirstColumn",
        // format is called when the on init and when a sorting has finished
        format: function(table) {                               
                // loop all tr elements and set the value for the first
column  
                for(var i=0; i < table.tBodies[0].rows.length; i++) {
                        $("tbody tr:eq(" + (i - 1) + ")
td:first",table).html(i);
                }                                                               
        }
    });

    $("table").tablesorter({
        widgets: ['zebra','indexFirstColumn']
    });

});


amuhlou wrote:
> 
> 
> apologies, I see now that it isn't exactly what you're looking for
> 
> On Aug 7, 7:18 pm, amuhlou <amysch...@gmail.com> wrote:
>> I'm not sure if this helps, but you can configure tablesorter on a per
>> column basis
>>
>> http://tablesorter.com/docs/example-options-headers.html
>>
>> On Aug 7, 12:38 pm, gord007 <josef....@gmail.com> wrote:
>>
>> > great answer :D
>> > advise someone better?
>>
>> > thx
>>
>> > jQuery Lover-2 wrote:
>>
>> > > You can write a javascript function that will add a row count column
>> > > and after every table sort action will fire to clean the content of
>> > > the column and repopulate it with numbers from 1 to 100. You can use
>> > > tablesort's events:
>>
>> > > $("table").bind("sortEnd",function() {
>> > >   // write your code here
>> > > });
>>
>> > > ----
>> > > Read jQuery HowTo Resource  -  http://jquery-howto.blogspot.com
>>
>> > > On Sat, Jan 17, 2009 at 11:09 PM, Rick Pasotto <r...@niof.net> wrote:
>>
>> > >> On Sat, Jan 17, 2009 at 10:02:01AM -0800, MorningZ wrote:
>>
>> > >>> So to clarify, you always want that column to be sequentially 1 to
>> n
>> > >>> where n is the number of rows?
>>
>> > >> Yes.
>>
>> > >>> and if so, and the sort is descending, would it be n to 1 ?
>>
>> > >> No. the first row should always rank #1. The user can reverse the
>> sort
>> > >> order if he wants to. The user wants to know the rank of some row
>> near
>> > >> the middle of the table without having to manually count the rows.
>>
>> > >>> On Jan 17, 12:10 pm, Rick Pasotto <r...@niof.net> wrote:
>> > >>> > I have a table in which the first column is the row number
>> (always
>> > >>> from
>> > >>> > 1 at the top to 100 at the bottom) so no matter how the other
>> columns
>> > >>> > are sorted that first column should be the 'rank' for that
>> particular
>> > >>> > sort.
>>
>> > >>> > Is it possible to do this with tablesorter? Could I change the
>> values
>> > >>> in
>> > >>> > the first column after tablesorter did it's work?
>>
>> > >>> > I see how to disable sorting on the first column but that is not
>> what
>> > >>> I
>> > >>> > want.
>>
>> > >>> > Could someone suggest another way to achieve what I want?
>>
>> > >>> > --
>> > >>> > "Everything that you can imagine is real." -- Pablo Picasso
>> > >>> >     Rick Pasotto    r...@niof.net    http://www.niof.net
>>
>> > >> --
>> > >> Our doctrine is based on private property. Communism is based on
>> > >> systematic plunder, since it consists in handing over to one man,
>> > >> without compensation, the labor of another. If it distributed to
>> > >> each one according to his labor, it would, in fact, recognize
>> > >> private property and would no longer be communism.
>> > >>        -- Frédéric Bastiat (1801-1850)
>> > >>    Rick Pasotto    r...@niof.net    http://www.niof.net
>>
>> > --
>> > View this message in
>> context:http://www.nabble.com/disable-column-from-sorting-in-tablesorter-tp21...
>> > Sent from the jQuery General Discussion mailing list archive at
>> Nabble.com.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/disable-column-from-sorting-in-tablesorter-tp21518538s27240p24876834.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to