Monday, 15 April 2013

html - Assign a bootstrap class to a dynamic javascript table -


I have a form for table and CRUD witch, I've styled a bit with bootstrap, but I also have a good table I want to see it, so I tried.

tbl.className = 'Table Table-Stripe Table-Border-Table-Dense';

and

Tbl.setAttribute ("class", "table-table-striped table-border table-condensate");

The table is getting the class, but there is no style. I can not figure out what the problem is.

  function skapaTabell (productive) {document.getElementById (" Table "). InnerHTML = ""; Var tbl = document.createElement ("table"); Tbl.className = 'Table Table-Stripe Table-Bordered Table-Condensation'; // attribute has so far for //tbl.setAttribute ("border", "1"); Tbl.setAttribute ("id", "table"); Tbl.setAttribute ("class", "table-table-striped table-table-condensate"); Var tblTr = document.createElement ("tr"); Var tblTh = document.createElement ("th"); // Skepar Rubinar Works Live Type = document.createTextNode ("ID"); TblTh.appendChild (thText); Var tblTh1 = document.createElement ("th"); Var thText1 = document.createTextNode ("productive"); TblTh1.appendChild (thText1); Var tblTh2 = document.createElement ("th"); Var thText2 = document.createTextNode ("category"); TblTh2.appendChild (thText2); Var tblTh3 = document.createElement ("th"); Var thText3 = document.createTextNode ("pre"); TblTh3.appendChild (thText3); Var tblTh4 = document.createElement ("and"); Var thText4 = document.createTextNode ("message"); TblTh4.appendChild (thText4); Var tblTh5 = document.createElement ("th"); Var thText5 = document.createTextNode ("Bild"); TblTh5.appendChild (thText5); TblTr.appendChild (tblTh); TblTr.appendChild (tblTh1); TblTr.appendChild (tblTh2); TblTr.appendChild (tblTh3); TblTr.appendChild (tblTh4); TblTr.appendChild (tblTh5); Tbl.appendChild (tblTr); Var i = 0; Do {// Langer Dane Neither Redondhen Seat Eye Tableen New Nun. RO = TBL.Instant RAW (-1); // varje ny rad behoever fyra 6 new new columns for cellar eFetterm product = newRow.insertCell (0); Var newCell2 = newRow.insertCell (1); Var newCell3 = newRow.insertCell (2); Var newCell4 = newRow.insertCell (3); Var newCell5 = newRow.insertCell (4); Var newCell6 = newRow.insertCell (5); NewCell.innerHTML = Manufacturer [i] .id; NewCell2.innerHTML = Manufacturer [i] .namn; NewCell3.innerHTML = Manufacturer [i] .kategori; NewCell4.innerHTML = Manufacturer [i] .pris; NewCell5.innerHTML = Producer [i] .info; NewCell6.innerHTML = '& lt; Img src = "'+ productive [i] .url +' height =" 100 "width =" 50 "& gt; '; i ++;} while (i & lt; produkter.length); // tab ski visa With an element ID table document.getElementById ("tabell") appendChild (tbl).  

}

Thanks in advance.

< P>

No comments:

Post a Comment