How to add a div id using sDom

How to add a div id using sDom

apalumboapalumbo Posts: 1Questions: 0Answers: 0
edited September 2011 in DataTables 1.8
Hello,

I'am trying to add a div containing an image button in .net but with no success:

In my Head: this function is called when my gridview is bound.
[code]


/* Mise en forme Gridview avec plugin datatable */
function Init_Order_DataTable(gvID) {
var oTable = $(gvID).dataTable({
"bJQueryUI": true,
"bProcessing": true,
"bPaginate": true,
"sPaginationType": "full_numbers",
"oLanguage": {
"sUrl": "../../common/js/datatable_fr-FR.txt"
},
"aaSorting": [],
"aoColumns": [
{ "bSortable": false }, { "sType": "date-euro" }, null, null, null, null, { "sClass": "td_right"}],
"aoColumnDefs": [
{ "sClass": "td_center", "aTargets": [0, 1, 2, 3, 4, 5]}],
"sDom": '<"H"lfr><"#Export">t<"F"ip>'
});

}


[/code]

So my problem is with sDom:

[code]
"sDom": '<"H"lfr><"#Export">t<"F"ip>'
[/code]


And then in the body:

[code]



[/code]

Have you got any idea?

Thanks in advance for your help.

Replies

  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    the sDom will place the div for you, but you'll need to fill it in with Javascript:

    [code]
    // I don't know ASP, so I'll assume you can write your img tag into a Javascript var named img
    var img = "";

    $("#Export").css("float", "right").css("padding-bottom", "3px").html(img);
    [/code]
  • allanallan Posts: 63,368Questions: 1Answers: 10,449 Site admin
    This example might be of some interest: http://datatables.net/release-datatables/examples/advanced_init/dom_toolbar.html . You could create the element as fbas suggests and then just move it into the element that DataTables created with a simple appendTo().

    Allan
  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    you could also remove the .css() calls and include the css specs in stylesheet file, of course.
This discussion has been closed.