JavaScript How to query a local websql DB with Kendo UI

Forgive me if this question is too broad for SO but I'm struggling to find any examples of what I need and thought someone may be able to point me in the right direction.

I'm just starting out with Kendo UI mobile and am trying to find a tutorial or any example code for creating/querying a local client side websql database within kendo ui mobile. There is nothing in the docs...

Can anyone help?

Thanks in advance

Answer:1

You can create a custom transport for the Kendo DataSource. For example in transport.read you can perform a query to your websql database and return the result:

var dataSource = new kendo.data.DataSource({
   transport: {
      read: function(options) {

        db.transaction(function(tx) {

          tx.executeSql('SELECT * from my_table', [], function(tx, result) {

             var data = [];
             // copy the rows to a regular array
             for (var i = 0; i < result.rows.length; i++) {
                data[i] = result.rows.item(i);
             }

             options.success(data); // return the data back to the data source
          });
        });
      }
   }
});

Here is a full CRUD demo: http://jsbin.com/azukin/4/edit

Answer:2

With JayData you can do it with just a few lines of code and it will support not only websql but indexeddb too http://jaydata.org/blog/jaydata-kendo-ui-awesomeness

Answer:3

I want to do something when I click anywhere, except when I click a div and it's children. This is what I've tried so far, but it's not working (clicking on it's children still executes what is ...

I want to do something when I click anywhere, except when I click a div and it's children. This is what I've tried so far, but it's not working (clicking on it's children still executes what is ...

Typekit requires us to include their JS file to render the fonts, e.g.: <script type="text/javascript" src="https://use.typekit.com/random-name.js"></script> <script type="text/...

Typekit requires us to include their JS file to render the fonts, e.g.: <script type="text/javascript" src="https://use.typekit.com/random-name.js"></script> <script type="text/...

  1. typekit host locally
  2. host typekit fonts locally

This code runs fine on Firefox, but I can't make the unload event work on Chrome anymore. Did Chrome stop supporting the unload event? This is my code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1....

This code runs fine on Firefox, but I can't make the unload event work on Chrome anymore. Did Chrome stop supporting the unload event? This is my code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1....

  1. canvas
  2. canada
  3. canada goose
  4. cane corso
  5. cancelled
  6. canes
  7. candace parker
  8. canker sore
  9. can bernie still win
  10. candy
  11. cancer
  12. cancun
  13. canon
  14. canvas prints
  15. cancer sign
  16. candace owens
  17. candyman
  18. candytopia
  19. candid
  20. cancer zodiac

Can you help me please to consider where to place resource (service) specific business logic in AngularJS. I feel it should be great to create some model-like abstraction over my resource, but I'm not ...

Can you help me please to consider where to place resource (service) specific business logic in AngularJS. I feel it should be great to create some model-like abstraction over my resource, but I'm not ...