Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

202
Views
How to Refresh table with kendo datasource updates from object, not from ajax request

I have an issue, when I bind data with kendo to a Table I'm using a kendo.data.DataSource object and I'm binding to a table like:

    <table class="myClass" id="myTable">
        <thead>
            <tr>
                <th data-bind="visible:Name">Name.Title"</th>
                <th data-bind="visible:Type">Type.Title"</th>
                <th data-bind="visible: DateAdded">"CreatedDate.Title"</th>
            </tr>
        </thead>
        <tbody id="contactsListView" data-role="listview"
               data-bind="source: ListViewSource"
               data-template="Template"></tbody>
    </table>

on JS I am filling like this:

ListViewSource: new kendo.data.DataSource({
    serverPaging: true, // <-- Do paging server-side.
    serverSorting: true, // <-- Do sorting server-side.
    transport: {
        read: {
            data: function () {
                  return globalVariableWithObjectList;
            }
        }
    },
    schema: {
        data: function () {
            return globalVariableWithObjectList;
        }
    }
}),

and it works for fill table on the first load, but if with some actions I add or delete an element It does not refresh on the table. I'm trying to refresh with:

ListViewSource.read();

It works when I have the kendo.data.DataSource like this:

contactsListViewSource: new kendo.data.DataSource({
    serverPaging: true, // <-- Do paging server-side.
    serverSorting: true, // <-- Do sorting server-side.
    transport: {
        read: {
            url: myUrl,//Where I'm getting the data
            dataType: "json",
            type: "POST"
        }
    },
    pageSize: 5,
    sort: { field: "CreatedDate", dir: "desc" },
    schema: {
        data: function () {
            return globalVariableWithObjectList;
        }
    }
}),

I am trying to reduce ajax numerous calls with only one when multiple data to update is needed, and storing data in global variables so that I can use them later. But the read() function for kendo.data.DataSource only refresh table data when it calls for an ajax request and non when I try to get data from the global variable, does anyone knows how can I make it work while reading from the variable ?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Use contactsListViewSource.add(newRecord); for adding new records to the data source, it will automatically bind to HTML list (MVVM) and display it.

Call contactsListViewSource.sync() to send data to server. contactsListViewSource.sync() will call transport.create method if new records are added.

Working example: ListView MVVM

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!