html - Jquery Jtable is not working for 2nd click -


i trying use jtable in project, when button clicked jtable need displayed , when click on button data need displaed , when again come click same jtable button , jtable not populating not sure why happending. code:

<!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>jquery jtable setup in java</title> <!-- include 1 of jtable styles. --> <link href="css/metro/blue/jtable.css" rel="stylesheet"     type="text/css" /> <link href="css/jquery-ui-1.10.3.custom.css" rel="stylesheet"     type="text/css" /> <!-- include jtable script file. --> <script src="js/jquery-1.8.2.js" type="text/javascript"></script> <script src="js/jquery-ui-1.10.3.custom.js" type="text/javascript"></script> <script src="js/jquery.jtable.js" type="text/javascript"></script> <script type="text/javascript"> //  $(document).ready(function() {     function getuser(){         $('#studenttablecontainer').jtable({             title : 'students list',             actions : {                 listaction : 'controller?action=list'             },             fields : {                 studentid : {                     title : 'student id',                     width : '30%',                     key : true,                     list : true,                     create : true                 },                 name : {                     title : 'name',                     width : '30%',                     edit : false                 },                 department : {                     title : 'department',                     width : '30%',                     edit : true                 },                 emailid : {                     title : 'email',                     width : '20%',                     edit : true                 }             }         });         $('#studenttablecontainer').jtable('reload');         }     //);     function getadmin()     {         var html='';         html +='<h1>i working</h1>';         $("#studenttablecontainer").html(html);     } </script>  </head> <body> <button onclick="getuser()"  >user</button> <button onclick="getadmin()">admin</button>     <div style="width: 80%; margin-right: 10%; margin-left: 10%; text-align: center;">         <h4>jquery jtable setup in java</h4>         <div id="studenttablecontainer"></div>     </div> </body> </html> 

if want load table when click button, example in button "admin", need use jtable('load'), here code:

function getadmin(){     $("#studenttablecontainer").jtable('load'); } 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -