1
<script type="text/javascript">  
      $(document).ready(function()
               {
                        $("#datetbtn").click(function(){
                     db.transaction(function(tx) {
                     tx.executeSql('SELECT * FROM materials_table ORDER BY time;',[], querySuccess);
                         });    
                                                });
                                                });
     </script> 


function updateMaterialDB(tx) {
                time = new Date();
query = 'INSERT INTO materials_table (id, material_title, type, course_id,last_accessed,) VALUES (' 

                + time + '", "'
                + size + '", "'
                + is_downloaded
                + '")';
                query = query.replace(/\//g,"");
                console.log(query);
                tx.executeSql(query);
            }

Here i want to display the values order by date using jquery ? here the values are not changed in the line using query

tx.executeSql('SELECT * FROM materials_table ORDER BY time;',[], querySuccess);
                         });   
Code Lღver
  • 15,573
  • 16
  • 56
  • 75

1 Answers1

0

Take the data in json format and in json format you can sorting data.

Reference : Sorting a JavaScript object by property name

Community
  • 1
  • 1
Gaurav Agrawal
  • 4,355
  • 10
  • 42
  • 61