Forum
12:30
31/08/2010
Hello Everybody,
first of all I want to compliment the jqGrid developers and contributors. I've been using jqGrid for a while now and I must say it's by far the best grid out there.
Now for my Problem:
I'm using jqGrid to realise a dynamic search grid, which has to be reloaded/rebuild with new collumns when selecting a certain search type.
Before selecting type
After selecting type
My Problem is that I can't figure out how I can cath the 'select'-event in the integrated searchtoolbar.
Until now I did trigger the reload by using another select outside the grid (which I wanna get rid of 😛 )
Any help is welcome
Regards
Carlo
16:52
31/08/2010
Hi Oleg!
thanks for your Help. I was just about to reply the answer myself (stupid me for not reading the manual right )
-> http://www.trirand.com/jqgridw.....rch_config
Anyway maybe you can help me again.
I still get an error with the following configuration.
Firebug says "break on error: d is undefined" and the grid is loaded without the searchtoolbar
{
"colNames":["Name","Type","Description"],
"colModel":[
{
"name":"name",
"index":"name",
"width":"450",
"classes":"cross_link"
},
{
"name":"type",
"index":"type",
"stype":"select",
"editoptions":{"value":":All;Interface:Interface;Technical Team:Technical Team;Stream:Stream;"},
"searchoptions":{
"dataEvents":
[
{
"type":"change",
"fn":"function(e) {reloadGrid($(e.target).val()); }"
}
]},
"width":"110″},
…
}
thanks for your time
Carlo
00:24
10/08/2009
Probably you forgot to include some jqGrid js-file. You should post your full code inclusive HTML with the headers which shows the order of js files and CSS which are loaded.
Look at this example http://www.ok-soft-gmbh.com/jq.....Filter.htm, which was the answer to http://stackoverflow.com/quest.....ery-jqgrid.
It shows another things, but it is a working example used searching in the toolbal. In the code I included some debug versions of the jqGrid files. Debug versions you find in src directory of the jqGrid.
Regards
Oleg
16:26
31/08/2010
hmm are you sure? the whole grid works great and is fully functional ONLY the integrated searchtoolbar disapears, when I try to set the searchoptions like this:
"dataEvents":
[
{
"type":"change",
"fn":"function(e) {reloadGrid($(e.target).val()); }"
}
]}
I repeat: usually the Grid is fully functional, also the integrated searchtoolbar works great so I guess it's a configuration problem, but maybe I'm wrong .
I can't post the full HTML cause I'm working on a Intranet Project (which is also pretty big), but I will post all relevant Parts.
I'am using the full 3.7.1 package (minified skript)
Here my includes
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<!– blueprint grid –>
<link rel="stylesheet" href="css/blueprint/screen.css" type="text/css" media="screen, projection">
<link rel="stylesheet" href="css/blueprint/print.css" type="text/css" media="print">
<!– blueprint grid fluid –>
<link rel="stylesheet" href="css/blueprint/liquid.css" type="text/css" media="screen">
<!–[if lt IE 8]>
<link rel="stylesheet" href="css/blueprint/ie.css" type="text/css" media="screen, projection">
<![endif]–>
<!– JQuery theme –>
<link type="text/css" href="css/redmond/jquery-ui-1.8.2.custom.css" rel="stylesheet" />
<!– jqGrid –>
<link rel="stylesheet" type="text/css" media="screen" href="css/jqgrid/ui.jqgrid.css" />
<!– JQuery Multiselect plugin –>
<link rel="stylesheet" type="text/css" media="screen" href="css/ui.multiselect.css" />
<!– Own css –>
<link rel="stylesheet" type="text/css" media="screen" href="css/screen.css" />
<!– JQuery script –>
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.2.custom.min.js"></script>
<!– JQuery Plugin Multiselect –>
<script src="js/plugins/localisation/jquery.localisation-min.js" type="text/javascript"></script>
<script src="js/plugins/scrollTo/jquery.scrollTo-min.js" type="text/javascript"></script>
<script src="js/ui.multiselect.js" type="text/javascript"></script>
<!– jqGrid scripts –>
<script src="js/i18n/grid.locale-en.js" type="text/javascript"></script>
<script src="js/jquery.jqGrid.min.js" type="text/javascript"></script>
<!– jqGrid fluid adapter script –>
<script src="js/jquery.jqGrid.fluid.js" type="text/javascript"></script> </head>
The following function should be trigered the moment the 'select' is changed, and rebuilds the grid with the new ColModel and ColNames.
function reloadGrid(){
var colNameseAndColModel=null;
colNameseAndColModel= getColNamesAndColModel();
$('#fo_search').GridUnload();
createSearchGrid(colNameseAndColModel);
resize_the_grids();
}
colNames and colModel are generated serverside and look exactly like in Post 3
Here is the function which builds my grid:
function createSearchGrid(res) {
jQuery("#fo_search")
.jqGrid(
{
url : 'Listener',
id : 'fo_search',
datatype : 'json',
mtype : 'POST',
colNames : res.colNames,
colModel : res.colModel,
pager : '#fo_search_pager',
rowNum : 25,
rowList : [ 25, 50, 100 ],
sortable : true,
sortname : 'invid',
sortorder : 'asc',
viewrecords : true,
shrinkToFit : false,
autowidth : true,
toppager : true,
height : 'auto',
postData : {
action : 'fo_search',
//type : $('#search_type').val()
},
beforeRequest: function (){
//reloadGrid();
//if ($('#gs_type').val())
},
onCellSelect : function(rowid, iCol,cellcontent, e) {
var isLink = $(
".//tr[id='" + rowid + "']")
.children().eq(iCol).hasClass(
"cross_link");
if (isLink) {
openInfoDialog('testType',
'testName', rowid);
}
}
}
);
Greetings
Carlo
12:28
31/08/2010
Problem Solved by taking the easy way out :
instead of trying to catch the select event through the jqgrid functionality, I removed all events which were bind to the select element and attached my own change event.
$('#gs_type').unbind();
$('#gs_type').change(
function() {
reloadGrid();
}
);
I still wonder what I did wrong in my previous attempts :S
it would be great if someone could have a look at my configuration.
Thanks in advance
Carlo
Most Users Ever Online: 715
Currently Online:
53 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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66