Kendo UI uses a summary of small knowledge points and kendoui knowledge points

Source: Internet
Author: User

Kendo UI uses a summary of small knowledge points and kendoui knowledge points
This Guide applies to users who know the basic syntax of the kendo UI. If you do not know the basic syntax of the Kendo UI, read the Demo and write several widgets by yourself.

1. Get the control entity of the Kendo UI without saving it as a global variable.

After the control is initialized, you only need
$("#id").data("kendoGrid")
For treeView, data is kendoTreeView, and so on.

2. You do not need to use global variables to obtain dataSource.

Var grid = $ ("# id "). data ("kendoGrid"); var dataSource = grid. dataSource; // obtain the Beanvar dataList = dataSource of dataSource. view (); // obtain the data list, which is an Array
3. Have you ever encountered a problem of loading kendoTreeView when developing a node that cannot find the tree? The main reason is that, if it is not expanded, the child node is not loaded and the corresponding node cannot be found. Previously I used expand all, and then collapse all the methods until I found this property ......
loadOnDemand:false
The API is like this.

    Indicates whether the child DataSources should be fetched lazily when parent groups get expanded. Setting this to false causes all child DataSources to be loaded at initialization time.

Generally, it indicates whether the child data source is loaded when the parent node is expanded. When this attribute is set to false, all sub-data sources are retrieved during initialization. 4. When talking about kendoTreeView, there is also a vertex, that is, the expansion of the Tree node. The tree node API provides three methods: expand, expandPath, and expandTo. I don't want to compare these three methods here, because I only use one of them to meet my needs. When I know the id of a node, expand it to the specified position.
Var barElement = treeView. findByUid (nodeID); // treeView is the kendoTreeView. Do not describe treeView. expandTo (treeView. dataItem (barElement) More; // expand all nodes

 

5. concerning the relationship between id and uid in kendoUI, the control entity uses uid as the unique identifier, Which is randomly generated when html is generated. When an Element is selected, kendoUI only provides two methods: findByText and findByUid. In many cases, we use neither the name nor the uid of kendoUI, it is the unique identifier we obtain from the background. Previously, I used to bind the data in the schema of dataSource after obtaining the data, and set the uid of dataItem Id,Later, we found that a simpler method is that dataSource recognizes IDs.
var dataItem = grid.dataSource.get(data.id);var element = grid.findByUid(dataItem.uid);

 

6. select () methods for kendoGrid and kendoTreeView. When linking a tree with a table or in other cases, you need to select a row or an item on both trees. We can obtain an element based on the method in the previous article. In my experiments, treeView can be selected in this way, while grid always fails. The selected methods are as follows:
grid.select("tr[data-uid='" + grid.dataSource.get(data.id).uid + "']");treeView.select(element);

 

7. When kendoWindow and kendoGrid are used together, an exception occurs due to locating issues. I used a simple and crude method to set the height of the overflow unit in kendoGrid. Currently, no more elegant solution is found. Originally, the table ended at the red line, but it was supported in the dialog box.
#deletePersonGrid .k-grid-content{height:227px;}

8. There are no more than 8th items at the moment, but the eighth article is estimated and calculated to sum up an integer.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.