Sort and Individual column filtering from the head

Sort and Individual column filtering from the head

bakaynbakayn Posts: 14Questions: 0Answers: 0
edited October 2010 in General
i want Sort and Individual column filtering from head.

EXAMPLE 1: only sort, even when i make click on input heade.
[code]


Rendering engine
Browser
Platform(s)
Engine version
CSS grade









[/code]


EXAMPLE 2: sort and filter, but i want that the title is on the input filter.
[code]










Rendering engine
Browser
Platform(s)
Engine version
CSS grade


[/code]

(sorry my english, i from Chile, and speak spanish)

Replies

  • bakaynbakayn Posts: 14Questions: 0Answers: 0
    edited October 2010
    i have the solution, based in http://datatables.net/forums/comments.php?DiscussionID=775&page=1#Item_7

    my code solution:
    [code]
    $("thead input").click( function (e) { // i add this.
    stopTableSorting(e);
    this.focus();
    });

    $("thead input").keyup( function () {
    /* Filter on the column (the index) of this element */
    oTable.fnFilter( this.value, $("thead input").index(this) );
    } );

    $("thead input").each( function (i) {
    asInitVals[i] = this.value;
    } );

    $("thead input").focus( function () {
    if ( this.className == "search_init" )
    {
    this.className = "";
    this.value = "";
    }
    } );

    $("thead input").blur( function (i) {
    if ( this.value == "" )
    {
    this.className = "search_init";
    this.value = asInitVals[$("thead input").index(this)];
    }
    } );

    function stopTableSorting(e) { // i add this
    if (!e)
    var e = window.event;
    e.cancelBubble = true;
    if (e.stopPropagation)
    e.stopPropagation();
    }
    ...




    Engine





    Browser





    Platform(s)





    Engine version





    CSS grade






    [/code]
This discussion has been closed.