JQuery Easyui Using Notes

Source: Internet
Author: User

We have four chance to rob a ticket. The first time is 30 minutes after the time of the ticket Release. The second chance is 15 days before driving. The third opportunity is 48 hours before Driving. The fourth opportunity is 24 hours before Driving.

1. Import JS

2.datagrid Reload

3. Popup div to open a new page

4. Implementing Paging

5. Double-click

6. Nesting a nested table

Import Js,css
<link href= "themes/default/easyui.css" rel= "stylesheet" type= "text/css"/>
<link href= "themes/default/easyui.su.css" rel= "stylesheet" type= "text/css"/>
<link href= "themes/icon.css" rel= "stylesheet" type= "text/css"/>
<script src= "scripts/jquery.min.js" type= "text/javascript" ></script>
<script src= "scripts/jquery.cookie.js" type= "text/javascript" ></script>
<script src= "scripts/jquery.easyui.min.js" type= "text/javascript" ></script>
<script src= "scripts/jquery.easyui.utility.js" type= "text/javascript" ></script>
<script src= "scripts/login/jquery.browser.js" type= "text/javascript" ></script>
<script src= "scripts/easyui-lang-zh_cn.js" type= "text/javascript" ></script>
<%--<script src= "scripts/print_btn.js" type= "text/javascript" ></script>
<script src= "scripts/commonfn.js" type= "text/javascript" ></script>--%>
<script src= "scripts/datagrid-detailview.js" type= "text/javascript" ></script>
<script src= "scripts/ajaxupload.3.5.js?v=1.1" type= "text/javascript" ></script>

--datagrid modified quantity, Uppnumber () to be defined inside The. aspx file
{field: "qty", title: ' quantity ', width:undefined, align: ' center ', sortable:true, formatter:function (value, row, Index) {
If (row.gi_code! = "page totals" && row.gi_code! = "total Totals") {
Return ' <input name= ' pnumber ' dno= ' + row. DNO + ' "value=" ' + value + ' "type=" text "style=" width:78px; "class=" easyui-numberbox "onchange=" uppnumber (this.value, ' + ROW. DNO + ') "/>";
}
else {
Return value;
}
}
},

Modify Quantity
function Uppnumber (qty, Id) {

If (qty > 0) {
$.ajax ({
Url:url + "? action=pnumber",
Type: "post",
Data: {qty:qty, dno:id},
Success:function (msg) {
Infoalert (msg);
$ ("#tb_PODetail"). DataGrid ("reload"); Can comment
}
});
}
else {
$ (this). Val ("")
Alert ("purchase quantity greater than 0!");
}
}

DataGrid reload?

// load, Paging will start at page 1th $ (' #dg '). datagrid (' load ', {    ' name01 ',    ' n '}); // reload , paging when loading the current page data, you want to refresh, should be with this, if just refresh, do not need parameters, you can directly use  $ (' #dg '). DataGrid (' Reload '); $ (' #dg '). DataGrid (' Reload ', {    ' n ',    ' name01 '});
View Code

Pop-up div $ ("#div_Search"). Dialog ("open");

Open page Openmodaldialog ("goodsedit.aspx?code=" + row.code);

Paging request.form["page"]

request.form["rows"]

int start = ((convert.toint32 (request.form["page"]. ToString (). Trim ())-1) * Convert.ToInt32 (request.form["rows"]. ToString (). Trim ())) + 1;

int end = (convert.toint32 (request.form["page"]. ToString (). Trim ())-1) * Convert.ToInt32 (request.form["rows"]. ToString (). Trim ()) + convert.toint32 (request.form["rows"]. ToString (). Trim ());

Return JSON

1 result2 = "{\" total\ ":" + "+" + ", \" rows\ ":" + result + "}"; Total row number, rows displayed by row

2 json + = ", \" pagetotal\ ": \" "+ DT. Rows.Count + "\", \ "skucount\": \ "" + dt2. Rows.Count + "\", \ "skutotal\": \ "" + itotal + "\" "+"} "; Customize the data displayed in the Lower-right corner

1 Double-click Row

Ondblclickrow:function (rowIndex, Rowdata) {

var row = $ ("#tb_GoodsList"). DataGrid ("getselected");

If (row! = undefined) {

<%if (otype== "1") {%>

Window.returnvalue = row;

Window.close ();

<%}else{%>

Openmodaldialog ("goodsedit.aspx" + "id=" + row.gi_id + "&tt=1");

$ ("#dg_GoodsList"). DataGrid (' Reload ');

<%}%>

}

}

2 nesting DataGrid

view:detailview,

Detailformatter:function (index, Row) {

Return ' <div style= ' padding:2px ' ><table id= ' ddv-' + index + ' ></table></div> ';

},

Onexpandrow:function (index, Row) {

$ (' #ddv-' +index). DataGrid ({

Url:url + "? action=detaillist&oid=" +row.pc_id,//background request["oid"]

fitcolumns:false,

pagination:true,

pagesize:15,

Pagelist: [15, 30, 90, 120],

showfooter:true,

striped:true,

rownumbers:true,

singleselect:true,

autorowheight:true,

Loadmsg: ",

Height: ' Auto ',

columns:[[

{field: "pi_id", title: "id", hidden:true},

{field: "gi_code", title: "product code", width:undefined, align: ' Center '},

{field: "gi_shortname", title: ' commodity abbreviation ', width:undefined, align: ' Center '},

{field: "gs_name", title: ' specifications ', width:undefined, align: ' Center '},

{field: "gi_unit", title: ' unit ', width:undefined, align: ' Center ', sortable:true},

{field: "gi_importprices", title: ' sales price ', width:undefined, align: ' Center ', sortable:true},

{field: "pi_kc", title: ' inventory quantity ', width:undefined, align: ' Center '},

{field: "pi_jbkc", title: ' Alert inventory ', width:undefined, align: ' Center '},

{field: "pi_number", title: ' purchase quantity ', width:undefined, align: ' Center '},

{field: "pi_price", title: ' purchasing Unit price ', width:undefined, align: ' Center '},

{field: "pi_allmoney", title: ' Total price ', width:undefined, align: ' Center '},

]],

Onresize:function () {

$ (' #west_dg '). DataGrid (' fixdetailrowheight ', index);

},

Onloadsuccess:function () {

SetTimeout (function () {

$ (' #west_dg '). DataGrid (' fixdetailrowheight ', index);

},0);

}

});

$ (' #west_dg '). DataGrid (' fixdetailrowheight ', index);

}

1, Use this subgrid view, need to use to the official website to provide datagrid-detailview.js, which helps us to define detailview this kind of display VIEW.

In the process of use, we only need to replace the default view with DetailView in the main datagrid.

2. detailformatter, The initial code in the generated detail, is placed in a table, which can then be dynamically built into the DATAGRID.

3, when the main DataGrid has just been initialized to complete, does not show subgrid, at this time Subgrid does not exist, we do not create it.

So when do you want to create it? When we expand a piece of data in the main datagrid, that is, in the Onexpandrow event, we create a subgrid that it "governs".

4, the method of creating Subgrid is similar to the way to create a datagrid, but there are some fixdetailrowheight operations behind it.

Fixdetailrowheight This method is mainly in order to adjust the height of subgrid, if not added, may cause the height of the Subgrid will appear dislocation Situation.

But what's the difference between a settimeout of 0 and a direct call to function?

JQuery Easyui Using Notes

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.