EasyUI queryParams屬性 在請求遠程數據同時給action方法傳參


屬性名 屬性值類型 描述 默認值
queryParams object 在請求遠程數據的時候發送額外的參數。

代碼示例:

$('#dg').datagrid({
	queryParams: {
		name: 'easyui',
		subject: 'datagrid'
	}
});
{}

 Action方法:

//獲取數據的action方法
public ActionResult GetData(string name,string gender)
{
    BLL dll=new BLL();//業務層
    List<Student> listStu=bll.GetList("select * from dt where name="+name+" and gender="+gender);//獲取數據
    JsonResult jr=new JsonResult();
    int res=listStu.Count;//total
    jr.Data=new{total=res,rows=listStu};
    return jr;
}

前台HTML:

<table id="tt">
    /* datagrid  code*/
</table>

<script>
    $(function(){
        $("#tt").datagrid({queryParams:{name:'小白',gender:true}},url:'...');//參數
})
</script>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM