嗨,我需要在下拉列表中选择选项时显示一个 flexigrid,我有三个选项,根据我需要显示适当的 felxigrid 的选择,我该怎么做?
$(document).ready(function () {
$('.group').hide();
$('#option1').show();
$('#selectMe').change(function () {
$('.group').hide();
$('#'+$(this).val()).show();
});
});
<div id="Dialog1" class="group">
<table id="InfoFlexGrid1">
</table></div>
<div id=Dialog2" class="group"><table id="InfoFlexGrid2">
</table></div>
<div id="Dialog3" class="group"><table id="InfoFlexGrid3">
</table></div>
$(document).ready(function(){
$("#cardInfoFlexGrid1").flexigrid({
dataType: 'json',
//url: "verification_rep.json",
colModel : [
{display: 'Name', name : 'Name', width : 120,align: 'center',sortable : false },
{display: 'Roll No', name : 'RollNo', width : 150, align: 'center' },
{display: 'Description', name : 'description', width : 150, align: 'center', hide: false},
{display: 'Remarks', name : 'remarks', width : 250,align: 'center', hide: false},
{display: 'Date', name : 'date', width : 100,sortable : false, align: 'center'}
],
searchitems : [
{display: 'Name', name : 'Name'},
{display: 'Roll No', name : 'RollNo', isdefault: true}
],
buttons:[
{name: 'Add', bclass: 'add', onpress : test},
{name: 'Update', bclass: 'update', onpress : test},
{name: 'Delete', bclass: 'delete', onpress : test},
{separator: true}
],
sortname: "Name",
sortorder: "asc",
title: 'Statistical Data Report',
usepager: true,
useRp: true,
rp: 15,
showTableToggleBtn: true,
width: 400,
height: 100,
singleSelect: true,
nowrap: true
});
rows = new Array();
rows.push({cell: ['Sample1','Sample','Sample','2','Y' ] },
{cell: ['Sample2','Sample','Sample','2', 'Y' ] }
);
data = {
total: 2,
page:1,
rows: rows
}
});
function test(com, grid) {
//alert("Hello");
if(com=='Update'){
$('#message-dialog').dialog().dialog("open");
$('#InfoFlexGrid1').flexAddData(data);
}else if(com=='Delete'){
confirm('Delete ' + $('.trSelected', grid).length + ' items?')
$('.trSelected', grid).remove();
}else if(com=='save'){
alert("Hello");
// $("#manualDatEntryDialog").dialog("open");
}
}
function procMe(com, grid) {
var gridRows = $("#InfoFlexGrid1 tbody tr");
gridRows.click(function(event){
displaySelectedItem($(this).attr('id').substr(3));
return false;
});
}
像这样,我的页面中还有两个 flexigrid,我想在下拉列表中选择的每个选项上显示一个 flexigrid。对此有任何想法吗?