Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
Help! jqgrid onclick or click only works once
18/06/2013
00:30
Avatar
crohit
New Member
Members
Forum Posts: 2
Member Since:
17/06/2013
sp_UserOfflineSmall Offline

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:

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<meta http-equiv="X-UA-Compatible" content="IE=edge" />

<link rel="stylesheet" type="text/css" media="screen" href="css/redmond/jquery-ui-1.10.3.custom.css" />

<link rel="stylesheet" type="text/css" media="screen" href="css/ui.jqgrid.css" />

<script src="js/jquery-1.9.0.min.js" type="text/javascript"></script>

<script src="js/i18n/grid.locale-en.js" type="text/javascript"></script>

<script src="js/jquery.jqGrid.min.js" type="text/javascript"></script>

<script type="text/javascript">

$.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);

});

}

</script>

<title>Server search</title>

</head>

<body>

<h1>PM ADDM</h1>

<form method="get" action="/">

<ul>

<li>

<input type="text" name="hostName" id="hostName" placeholder="host name" >

</li>

<li>

<input type="text" name="osType" id="osType" placeholder="operating system" >

</li>

<li>

<input type="text" name="processor" id="processor" placeholder="processor family" >

</li>

<li>

<input type="button" value="Search servers" onclick="javascript:get_servers();">

</li>

</form>

<ul>

<li>

<a href="#" id="mylink" onclick="javascript:get_servers();">Search servers</a>

</li>

<li>

<div style="cursor: pointer;" onclick="get_alert()"> Click here</div>

</li>

</ul>

<!-- -->

Server List

<table id="list10"></table>

<div id="pager10"></div>

<br />

CPU Info

<table id="list10_d"></table>

<div id="pager10_d"></div>

<!-- -->

</body>

18/06/2013
19:29
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

Check to see if you have a uniquie id's in the grid.

Regards

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

18/06/2013
23:43
Avatar
crohit
New Member
Members
Forum Posts: 2
Member Since:
17/06/2013
sp_UserOfflineSmall Offline

tony said:

Hello,

Check to see if you have a uniquie id's in the grid.

Regards


Yes, I do have unique ids in the grid for my data. If you see my code, you will notice that I have 3 different ways I am trying to circumvent the issue. But, if i DO NOT call jqgrid, then the onclick works every time. Thats where i show an JS Alert in my code.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
24 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information