I am using Master Detail grid. I have a Form, where the user inputs one or more search criteria and clicks a Button. The button calls the JS function, which in turn calls jqgrid master detail logic and shows the grids with the data returned from the server.
The problem is that the Button onclick only works One time. After that I have to do a page reload to make the onclick work again.
I tried calling another simple JS function (non jqgrid) and in that case Onclick works any number of times.
There is something in jqgrid code, that takes away my ability of onclick.
Please let me know if there is a setting or workaround for this.
thanks
Here is the code:
$.jgrid.no_legacy_api = true;
$.jgrid.useJSON = true;
$('mylink').click(get_servers());
function get_alert(){
alert("this sucks!!!");
}
function get_servers() {
jQuery("#list10").jqGrid({
url:"json/getServers.htm?hostName="+$('#hostName').val()+"&osType="+$('#osType').val()+"&processor="+$('#processor').val(),
datatype: "json",
colNames:['_id','dMesg','nisName','id','hostName','hypervisor_name','parserVersion','osType','cpuInfo','memory_GB','blkId','extended_attributes','serverName','processor_reference','dnsName','processor_frequency_GHz','memInfo','df','packages','lsPci','osVersion','partitions','name','ypName','lines','ifConfig','mounts','processor_system_count','dmiInfo'],
colModel:[
{name:'_id',index:'_id', key:true, width:50},
{name:'dMesg',index:'dMesg', width:50},
{name:'nisName',index:'nisName', width:50},
{name:'id',index:'id', width:50},
{name:'hostName',index:'hostName', width:50},
{name:'hypervisor_name',index:'hypervisor_name', width:50},
{name:'parserVersion',index:'parserVersion', width:50},
{name:'osType',index:'osType', width:50},
{name:'cpuInfo',index:'cpuInfo', width:50},
{name:'memory_GB',index:'memory_GB', width:50},
{name:'blkId',index:'blkId', width:50},
{name:'extended_attributes',index:'extended_attributes', width:50},
{name:'serverName',index:'serverName', width:50},
{name:'processor_reference',index:'processor_reference', width:50},
{name:'dnsName',index:'dnsName', width:50},
{name:'processor_frequency_GHz',index:'processor_frequency_GHz', width:50},
{name:'memInfo',index:'memInfo', width:50},
{name:'df',index:'df', width:50},
{name:'packages',index:'packages', width:50},
{name:'lsPci',index:'lsPci', width:50},
{name:'osVersion',index:'osVersion', width:50},
{name:'partitions',index:'partitions', width:50},
{name:'name',index:'name', width:50},
{name:'ypName',index:'ypName', width:50},
{name:'lines',index:'lines', width:50},
{name:'ifConfig',index:'ifConfig', width:50},
{name:'mounts',index:'mounts', width:50},
{name:'processor_system_count',index:'processor_system_count', width:50},
{name:'dmiInfo',index:'dmiInfo', width:50}
],
rowNum:10,
rowList:[10,20,30],
pager: '#pager10',
sortname: 'id',
viewrecords: true,
sortorder: "desc",
multiselect: false,
caption: "Server list",
onSelectRow: function(ids) {
if(ids == null) {
ids=0;
if(jQuery("#list10_d").jqGrid('getGridParam','records') >0 )
{
jQuery("#list10_d").jqGrid('setGridParam',{url:"json/getCpuInfo.htm?_id="+ids,page:1});
jQuery("#list10_d").jqGrid('setCaption',"CPU Info: "+ids)
.trigger('reloadGrid');
}
} else {
jQuery("#list10_d").jqGrid('setGridParam',{url:"json/getCpuInfo.htm?_id="+ids,page:1});
jQuery("#list10_d").jqGrid('setCaption',"CPU Info: "+ids)
.trigger('reloadGrid');
}
}
});
jQuery("#list10").jqGrid('navGrid','#pager10',{add:false,edit:false,del:false});
jQuery("#list10_d").jqGrid({
height: 100,
//url:'get_json_subgrid?_id=0',
datatype: "json",
colNames:['cpu family','model name','cache_alignment','vendor_id','flags'],
colModel:[
{name:'cpu family',index:'cpu family', width:100},
{name:'model name',index:'model name', width:100},
{name:'cache_alignment',index:'cache_alignment', width:100},
{name:'vendor_id',index:'vendor_id', width:100},
{name:'flags',index:'flags', width:100}
],
rowNum:5,
rowList:[5,10,20],
pager: '#pager10_d',
sortname: 'item',
viewrecords: true,
sortorder: "asc",
multiselect: false,
caption:"CPU Info"
}).navGrid('#pager10_d',{add:false,edit:false,del:false});
jQuery("#ms1").click( function() {
var s;
s = jQuery("#list10_d").jqGrid('getGridParam','selarrrow');
alert(s);
});
}
Server List
CPU Info
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top