Skip to content

Commit ab2800a

Browse files
author
Kendo Bot
committed
Sync with Kendo UI Professional
1 parent 8d725ac commit ab2800a

10 files changed

+720
-71
lines changed

docs/_config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -673,9 +673,9 @@ navigation:
673673
"*popover":
674674
isNew: true
675675
title: "Popover"
676-
"*progressbar":
676+
"*/progressbar":
677677
title: "ProgressBar"
678-
"*circularprogressbar":
678+
"*/circularprogressbar":
679679
title: "CircularProgressBar"
680680
"*rangeslider":
681681
title: "RangeSlider"

docs/api/javascript/data/datasource.md

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,24 +1503,43 @@ The following options are sent to the server when server paging is enabled:
15031503
- `skip` - The number of data items to skip.
15041504
- `take` - The number of data items to return (the same as `pageSize`).
15051505

1506+
The `skip` and `take` values are automatically calculated based on the current `page` and `pageSize`. This means that a dataSource with `page` = 3 and `pageSize` = 20 will generate a request that has `skip` = 40 and `take` = 20.
1507+
15061508
Use the [`parameterMap`](/api/javascript/data/datasource#configuration-transport.parameterMap) option to send the paging options in a different format.
15071509

1508-
For more information and tips about client and server data operations, refer to the [introductory article on the DataSource](/framework/datasource/overview#mixed-data-operations-mode).
1510+
For more information and tips about client and server data operations, refer to the [introductory article on the DataSource]({% slug overview_kendoui_datasourcecomponent %}#mixed-data-operations-mode).
15091511

15101512
For a runnable example with enabled server paging, you can visit [the Grid remote data binding demo.](https://demos.telerik.com/kendo-ui/grid/remote-data-binding)
15111513

15121514
#### Example - enable server paging
15131515

1516+
<div id="container"></div>
1517+
15141518
<script>
1515-
var dataSource = new kendo.data.DataSource({
1516-
transport: {
1517-
/* transport configuration */
1518-
},
1519-
serverPaging: true,
1520-
schema: {
1521-
total: "total" // total is returned in the "total" field of the response
1522-
}
1523-
});
1519+
var dataSource = new kendo.data.DataSource({
1520+
transport: {
1521+
// The remote endpoint which will receive the request parameters and return the response containing the data.
1522+
read: {
1523+
dataType: "jsonp",
1524+
url: "https://demos.telerik.com/kendo-ui/service/Products/Read",
1525+
}
1526+
},
1527+
serverPaging: true,
1528+
pageSize: 10, // The number of items per page.
1529+
page: 3 // Change the page property to see a different set of items. The endpoint contains 77 items in total. This means that there are eight pages (eight pages multiplied by 10 records each).
1530+
});
1531+
1532+
// The remote endpoint is configured to return the items in descending order. The first item is with ID = 77, the last item is with ID = 1
1533+
dataSource.fetch(function() {
1534+
let data = this.data(),
1535+
currentPage = this.page();
1536+
1537+
// For demo purposes, each item in the current page is rendered on the screen.
1538+
data.forEach((item) => {
1539+
let element = `<p>ID - ${item.ProductID}, Name = ${item.ProductName}, Page = ${currentPage}</p>`;
1540+
$("#container").append($(element));
1541+
});
1542+
});
15241543
</script>
15251544

15261545
### serverSorting `Boolean` *(default: false)*

docs/api/javascript/ui/grid.md

Lines changed: 60 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2873,6 +2873,12 @@ Each table row consists of table cells (`<td>`) which represent the grid columns
28732873

28742874
> Use the `template` to customize the way the column displays its value.
28752875
2876+
For additional and more complex examples that utilize column templates, visit the [`Knowledge Base`](https://docs.telerik.com/kendo-ui/knowledge-base) documentation, and use the following search terms:
2877+
2878+
- column template
2879+
- grid column template
2880+
- Column Template | Kendo UI Grid
2881+
28762882
#### Example - set the template as a string (wrap the column value in HTML)
28772883

28782884
<div id="grid"></div>
@@ -3622,29 +3628,37 @@ The text message displayed in the column menu for unlocking a column.
36223628

36233629
### dataSource `Object|Array|kendo.data.DataSource`
36243630

3625-
The data source of the widget which is used render table rows. Can be a JavaScript object which represents a valid data source configuration, a JavaScript array or an existing [kendo.data.DataSource](/api/javascript/data/datasource)
3626-
instance.
3631+
The data source of the Grid holds the items that will be rendered inside the widget. An item can be a JavaScript object which represents a valid data source configuration, a JavaScript array, or an existing [kendo.data.DataSource](/api/javascript/data/datasource) instance.
36273632

3628-
If the `dataSource` option is set to a JavaScript object or array the widget will initialize a new [kendo.data.DataSource](/api/javascript/data/datasource) instance using that value as data source configuration.
3633+
If the `dataSource` option is set to a JavaScript object or array, the widget will initialize a new [kendo.data.DataSource](/api/javascript/data/datasource) instance by using that value as a data source configuration.
36293634

36303635
If the `dataSource` option is an existing [kendo.data.DataSource](/api/javascript/data/datasource) instance the widget will use that instance and will **not** initialize a new one.
36313636

3632-
#### Example - set dataSource as a JavaScript object
3637+
> For live demos and more complex configurations, refer to the article on [binding the Grid to local data](https://demos.telerik.com/kendo-ui/grid/local-data-binding) and [binding the Grid to remote data](https://demos.telerik.com/kendo-ui/grid/remote-data-binding).
3638+
3639+
#### Example - set dataSource as a JavaScript object with data, page and pageSize properties
36333640

36343641
<div id="grid"></div>
36353642
<script>
3636-
$("#grid").kendoGrid({
3637-
columns: [
3638-
{ field: "name" },
3639-
{ field: "age" }
3640-
],
3641-
dataSource: {
3642-
data: [
3643-
{ name: "Jane Doe", age: 30 },
3644-
{ name: "John Doe", age: 33 }
3645-
]
3646-
}
3647-
});
3643+
$("#grid").kendoGrid({
3644+
columns: [
3645+
{ field: "name" },
3646+
{ field: "age" }
3647+
],
3648+
pageable: true,
3649+
// The dataSource configuration is an object which contains some data and a couple of configurations.
3650+
dataSource: {
3651+
data: [
3652+
{ name: "Jane Doe", age: 30 },
3653+
{ name: "John Doe", age: 33 },
3654+
{ name: "Mike Doe", age: 31 },
3655+
{ name: "Tom Doe", age: 35 },
3656+
{ name: "Danny Doe", age: 37 }
3657+
],
3658+
pageSize: 2, // The number of items displayed per page
3659+
page: 2 // Page 2 will be opened by default when the Grid loads.
3660+
}
3661+
});
36483662
</script>
36493663

36503664
#### Example - set dataSource as a JavaScript array
@@ -3656,6 +3670,7 @@ If the `dataSource` option is an existing [kendo.data.DataSource](/api/javascrip
36563670
{ field: "name" },
36573671
{ field: "age" }
36583672
],
3673+
// The dataSource configuration is a simple array with no additional configurations.
36593674
dataSource: [
36603675
{ name: "Jane Doe", age: 30 },
36613676
{ name: "John Doe", age: 33 }
@@ -3667,23 +3682,25 @@ If the `dataSource` option is an existing [kendo.data.DataSource](/api/javascrip
36673682

36683683
<div id="grid"></div>
36693684
<script>
3685+
// The dataSource is initialized as a stand-alone widget that can be bound to the Grid.
36703686
var dataSource = new kendo.data.DataSource({
36713687
transport: {
36723688
read: {
3689+
// The remote endpoint from which the data is retrieved.
36733690
url: "https://demos.telerik.com/kendo-ui/service/products",
36743691
dataType: "jsonp"
36753692
}
36763693
},
36773694
pageSize: 10
36783695
});
3696+
36793697
$("#grid").kendoGrid({
3698+
// The dataSource configuration is set to an existing DataSource instance.
36803699
dataSource: dataSource,
36813700
pageable: true
36823701
});
36833702
</script>
36843703

3685-
> Check [Binding to local data](https://demos.telerik.com/kendo-ui/grid/local-data-binding) and [Binding to remote data](https://demos.telerik.com/kendo-ui/grid/remote-data-binding) for live demos.
3686-
36873704
### detailTemplate `String|Function`
36883705

36893706
The [template](/api/javascript/kendo/methods/template) which renders the detail rows.
@@ -9572,27 +9589,34 @@ Fires the [edit](/api/javascript/ui/grid/events/edit) event.
95729589

95739590
#### Example - add a new data item
95749591

9592+
<button id="add">Add a new row</button>
95759593
<div id="grid"></div>
95769594
<script>
9577-
$("#grid").kendoGrid({
9578-
columns: [
9579-
{ field: "name" },
9580-
{ field: "age" }
9581-
],
9582-
dataSource: {
9583-
data: [
9584-
{ id: 1, name: "Jane Doe", age: 30 },
9585-
{ id: 2, name: "John Doe", age: 33 }
9586-
],
9587-
schema: {
9588-
model: { id: "id" }
9595+
$("#add").kendoButton({
9596+
themeColor: "success",
9597+
click: function() {
9598+
var grid = $("#grid").data("kendoGrid");
9599+
grid.addRow();
95899600
}
9590-
},
9591-
editable: true,
9592-
toolbar: ["save"]
9593-
});
9594-
var grid = $("#grid").data("kendoGrid");
9595-
grid.addRow();
9601+
});
9602+
9603+
$("#grid").kendoGrid({
9604+
columns: [
9605+
{ field: "name" },
9606+
{ field: "age" }
9607+
],
9608+
dataSource: {
9609+
data: [
9610+
{ id: 1, name: "Jane Doe", age: 30 },
9611+
{ id: 2, name: "John Doe", age: 33 }
9612+
],
9613+
schema: {
9614+
model: { id: "id" }
9615+
}
9616+
},
9617+
editable: true,
9618+
toolbar: ["save"]
9619+
});
95969620
</script>
95979621

95989622
### autoFitColumn

0 commit comments

Comments
 (0)