Resolving the Easyui control DataGrid two-time load problem

Source: Internet
Author: User
Tags call back

Using the URL method for beginners, often encounter the problem of repeated requests, the root cause of this problem is because once the URL parameters are set, the DataGrid component in the instantiation of the request, how to avoid the problem of secondary loading, the personal attention to the following two points basic can be prevented two times load. Using the load and reload functions to load the data dynamically instead of choosing to render the component again, the purpose of rendering the component again is simply to set the URL, which is not worth the effort, and the URL's settings can be obtained through the options method to the opts of the component instance. And then re-assign the value to the Opts.url, the class method to register the component, generally only write properties in the DOM, and the event is usually called the DataGrid constructor with Javascipt registration, the process has occurred two requests: the first time is the class mode instantiation , and the second time is when the JavaScript registers the event. So in the case of binding events, simply do not use the class method to register. Say so much in fact all above is nonsense; directly above: <table id= "Materialdata" class= "Easyui-datagrid" data-options= "toolbar: ' #tb '" ></ Table> to remove the class here, instead:
<table id= "Materialdata" data-options= "toolbar: ' #tb '" ></TABLE> because we wrote this in JS: $ (' #materialData '). The DataGrid ({}), so the body does not have to write his class, otherwise in the page load "table" when the call back, and in JS will also go to call. First write so much to understand it, and later found that the understanding of the wrong to add.

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.