Can I create a data table in JavaScript?

Posted by Allemahesh under JavaScript on 7/23/2013 | Points: 10 | Views : 4532 | Status : [Member] [MVP] | Replies : 4
Can I create a data table in JavaScript? If yes how to do this. If no, then how to achieve this?




Responses

Posted by: Kmandapalli on: 7/23/2013 [Member] Silver | Points: 25

Up
0
Down
Hi,

You can fing plugin for creating datatable using javascript.
You can download them and use it.

Mark as answer if satisfied.............


Thank You,
Shree M.

Kavya Shree Mandapalli

Allemahesh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Phagu007 on: 7/23/2013 [Member] Starter | Points: 25

Up
0
Down
Yes , You can create data table in java script . For more detail you can visit to
http://www.coderanch.com/t/117834/HTML-CSS-JavaScript/Create-table-JavaScript-dynamically

Allemahesh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Prabhukiran345 on: 7/24/2013 [Member] Starter | Points: 25

Up
0
Down
Yes you can..
Use this code

<script language="javascript" type="text/javascript">
var myArray = new Array();
myArray[0] = 1;
myArray[1] = 2.218;
myArray[2] = 33;
myArray[3] = 114.94;
myArray[4] = 5;
myArray[5] = 33;
myArray[6] = 114.980;
myArray[7] = 5;

var myTable= "<table><tr><td style='width: 100px; color: red;'>Col Head 1</td>";
myTable+= "<td style='width: 100px; color: red; text-align: right;'>Col Head 2</td>";
myTable+="<td style='width: 100px; color: red; text-align: right;'>Col Head 3</td></tr>";

myTable+="<tr><td style='width: 100px;'>---------------</td>";
myTable+="<td style='width: 100px; text-align: right;'>---------------</td>";
myTable+="<td style='width: 100px; text-align: right;'>---------------</td></tr>";

for (var i=0; i<8; i++) {
myTable+="<tr><td style='width: 100px;'>Number " + i + " is:</td>";
myArray[i] = myArray[i].toFixed(3);
myTable+="<td style='width: 100px; text-align: right;'>" + myArray[i] + "</td>";
myTable+="<td style='width: 100px; text-align: right;'>" + myArray[i] + "</td></tr>";
}
myTable+="</table>";

document.write( myTable);

</script>

Thanks,
Prabhu Kiran
MARK AS ANSWER..

Thanks,
Prabhu Kiran Bommareddy

Allemahesh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Mack.Richards18 on: 1/17/2014 [Member] Starter | Points: 25

Up
0
Down
Thank You "Prabhukiran345" for providing the detailed answer.
There are many plugins for the table but i rarely use them.

Allemahesh, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response