Embed a grid in the Magiccombo component to support paged and cross-page selection
?
1.
? 2. Code [JavaScript] Radio Sample code
<script type= "Text/javascript" src= "/js/mac/pager.js" ></script>
<script type= "Text/javascript" src= "/js/mac/grid.js" ></script>
<script type= "Text/javascript" >
$ (function () {
var gd1 = $ (' <div class= ' grid ></div> '). Mac (' Grid ', {
Key: ' No ',
Cols: [{
Field: ' Subject ', title: ' Subject ', width:150
},{
Field: ' Summary ', title: ' Summary ', width:150
},{
Field: ' Debit ', title: ' Debbit ', width:80, Sort:true,
Render:function (r, tr) {
Return ' <div class= ' money ' >$ ' +r.debit+ ' </div> ';
}http://www.huiyi8.com/jianbihua/?
},{
Field: ' Credit ', title: ' Credits ', width:80, Sort:true,
Render:function (r, tr) {
Return ' <div class= ' money ' >$ ' +r.credit+ ' </div> ';
} Simple Strokes Daquan
}],
Loader: {
URL: '/javascript/grid/data.php ',
Params: {pageno:1, pagesize:20},
Autoload:true
},
Pagerlength:10,
Onrowclick:function () {
var EC = $ (this);
Gd1.find ('. Tr '). Removeclass (' selected ');
Ec.addclass (' selected ');
var k = ec.attr (' name ');
gd1.selected = {};
GD1.SELECTED[K] = gd1.data[k];
Cb1.select (Gd1.data[k]);
Cb1.close ();
},
Afterload:function (DD, PO) {
Gd1.select (cb1.selected);
}
});
Gd1.select = function (SL) {
var at = Gd1.find ('. Tr '). Removeclass (' selected ');
$.each (SL, function (n, r) {
At.filter ("[name= '" + r.no + "']"). AddClass (' selected ');
});
}
var CB1 = $ (' #combo1 '). Mac (' combo ', {
Keyfield: ' No ',
Displayfield: ' Subject ',
boxwidth:490,
BOXHEIGHT:300,
WIDTH:200,
BOXEL:GD1,
Multiselect:false,
Onopen:function () {
Gd1.adjust (CB1);
Gd1.select (cb1.selected);
}
});
$ (' #get1 '). Click (function () {
Mac.alert (Json.stringify (cb1.selected[0));
});
$ (' #set1 '). Click (function () {
Cb1.select ({no:2, Subject: ' Subject 002 '});
});
$ (' button '). button ();
});
</script>
<div id= "Combo1" class= "combo Customcombo" ></div><br>
<button id= "Get1" >get1</button> <button id= "Set1" >set1</button >