datatables add combobox as a column

Posted by user403295 on Stack Overflow See other posts from Stack Overflow or by user403295
Published on 2010-12-23T04:45:28Z Indexed on 2010/12/23 4:54 UTC
Read the original article Hit count: 244

Filed under:
|

Hi to all,

I have got a datatable (http://www.datatables.net/). I have created and filled the table as shown below. Now I need to implement a combobox (assume that I have got 2010, 2011,2012) to allow the user select a year . then when user clicks View or Modify link, which is placed in the table, selected year will be passed to another page as a parameter. Now how can I turn my year column into a combobox?Thanks.

        rulesTableGlobal = $('#rulesTable').dataTable( {
            //"bJQueryUI": true,
            "sPaginationType": "full_numbers",
            "aoColumns": [
                 { "sTitle": "Id", "sWidth" : "20px" },
                 { "sTitle": "Property ID" , "sWidth"  : "20px"},
                 { "sTitle": "Adress" , "sWidth"  : "130px"},
                 { "sTitle": "Suburb" , "sWidth"  : "50px"},
                 { "sTitle": "Bond", "sWidth"  : "25px" },
                 { "sTitle": "Year", "sWidth"  : "25px" , "aType": "dom-select"},
                 { "sTitle": "View or Modify" , "sWidth"  : "50px"}]

        });

    function addPropertyToTable( lt_id, lt_uid, address, suburb_name, min_guests, max_guests,
                                 bondFee,cleaningFee,bookingServiceFee, weekly_rate,nightly_rate){

        var _lt_id = "\'" + lt_id + "\'";
        var viewLink    = '<A href="#" onclick="forwardDetails('+_lt_id+');">View and Modify</A>';          
        var year= "";

        $('#rulesTable').dataTable().fnAddData( [
                                 lt_id, lt_uid, address, suburb_name, bondFee,cleaningFee,bookingServiceFee,  weekly_rate,nightly_rate, min_guests, max_guests, year, viewLink ] );


    }

        });

    }

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about datatables.net