Wednesday, 15 September 2010

javascript - how to make datatables background image clickable -


I am using datatable which requires a clickable background image to be clickable for a particular column.

I am unable to keep it together. I can do it for the text but it can figure out how to do it for the background image. Can someone give a suggestion

here my javascript->

  $ (document) .ready (function () {var myArray = JSON.parse (document.getElementById ( "PopulateDT" ("# example"). $ ('#importation'). DataTable ({"sscrollY": "500px", "bPaginate": incorrect, "bScrollCollapse": true, aadata: myArray, "aoColumns" : "", "Sdefaultcontent": '' '', '' '', '' '' '' "Edit_save" & gt; getimage "& lt; / a & gt; '}, {" sClass ":" editimage "," Mdata ":" "," sDefaultContent ":' & lt; a href =" "class = "Editor_save"> This is an author of the word "{" sClass ":" deleteimage "," mData ":" "}}});});    The following is my html  
  & lt; table var = "Display" id = "example" cellpadding = "0" cell location = "0" limit = "0"> << thead>  ul> 
  • ; & Lt; a href = "addit.jsp" & gt; Add Code Edit & lt; / a & gt; & lt; / li & gt; & lt; li & gt; & lt; a href = "# "& Gt; Import & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; Export & lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; TR & gt; & Lt; Th & gt; Id & lt; / Th & gt; & Lt; Th & gt; Label & lt; / Th & gt; & Lt; Th & gt; CT & lt; / Th & gt; & Lt; Th & gt; Data & lt; / Th & gt; & Lt; Th & gt; UpdatedAt & lt; / Th & gt; & Lt; Th & gt; & Lt; / Th & gt; & Lt; Th & gt; & Lt; / Th & gt; & Lt; Th & gt; & Lt; / Th & gt; & Lt; / TR & gt; & Lt; / Thead & gt; & Lt; Tbody & gt; & Lt; TR & gt; & Lt; TD & gt; & Lt; / TD & gt; & Lt; TD & gt; & Lt; / TD & gt; & Lt; TD & gt; & Lt; / TD & gt; & Lt; TD & gt; & Lt; / TD & gt; & Lt; TD & gt; & Lt; / TD & gt; & Lt; Td square = "getimage" & gt; & Lt; / Td> & Lt; Td class = "edit" & gt; & Lt; / Td> & Lt; Td class = "deleted" & gt; & Lt; / Td> & Lt; / TR & gt; & Lt; / Tbody & gt; & Lt; / Table & gt;

    I want to make getimage, editimage and clickimage as clickable. I am trying to understand this link, but some help is needed to praise it.

    Here is an example that will change the background color:

      $ (document) .ready (function () {// click $ ('td', this) to handle .click (function () {$ (this) .css ("background-color" "," Red ");});});   

    OR

      $ (document) .ready (function () {// click $ ('td', this). () { $ (This) .addClass ("Panama-Red");});});   

    I recommend using .addclass instead of .css.

  • No comments:

    Post a Comment