Forum


13:26

06/10/2009

Ok, strange problem...
I have a field (2 to be exact...) that a user can fill and after that he can press search, and the jqgrid will start with data of the values entered...
My problem is: I am filling the default Value , and the data is ok, but on the first run the search is not performed.
If I press enter on the toolbar all is great, but not on the opening.
Here is my code:
function jsLoadGrid(){
//jQuery("#list2").jqGrid();
jQuery("#list2").GridUnload();
gridimgpath = "../styles/images";
var mygrid = jQuery("#list2").jqGrid({
datatype: 'json',
url: 'ItemTB.php', //?SearchId='+$("#itemNumber").val()+'&SearchDesc='+$("#description").val(), //call index.php to fill the jQuery
mtype: 'GET',
cache: false,
height: '350', //table
//search:true,
//rowList:[10,20,30,40,50],
{/literal}
colNames:['{$translation->LBL_OrderLineHandler_ITEM_NUM}',
'{$translation->LBL_CustTOrderHeader_DSC}',
'{$translation->LBL_OrderLineHandler_CODE_STOCK}',
'{$translation->LBL_OrderLineHandler_PRICE}',
'{$translation->LBL_OrderLineHandler_P_SIZE}',
{foreach from=$warehouseList item=warehouse}
'{$translation->LBL_OrderLineHandler_Warehouse} {$warehouse}',
{/foreach}
],
{literal}
colModel:[
{name:'ICAT',index:'SearchId', width:120,search:true,stype:'text', sortable:false,searchoptions:{defaultValue:$("#itemNumber").val()}},
{name:'IDSCO',index:'SearchDesc', width:280,search:true, sortable:false,searchoptions:{defaultValue:$("#description").val()} },
{name:'ICS',index:'ICS', width:80,search:false, sortable:false},
{name:'IPRC1',index:'IPRC1', width:90,align:"right",search:false, sortable:false},
{name:'IPACK',index:'IPACK', width:70, sortable:false,search:false},
{/literal}
{foreach from=$warehouseList key=k item=warehouse}
{if $warehouse neq ''}
{literal}{{/literal}name:'IQTY{$k+1}',index:'IQTY{$k+1}', width:100,align:"right",search:false, sortable:false{literal}},{/literal}
{else}
{literal}{{/literal}name:'IQTY{$k+1}',index:'IQTY{$k+1}', width:100,align:"right",search:false, hidden:true, sortable:false{literal}},{/literal}
{/if}
{/foreach}
{literal}
],
pager: jQuery('#pager2'),
imgpath: gridimgpath,
multiselect: false,
gridview : true,
gridModel: true,
autosearch: true,
//searchOnEnter: true,
stringResult: true,
//toolbar : [true,"top"],
onSelectRow: function(id) {
$("#itemNumber").val(id);
$("#description").val($("#list2").getCell(id,"IDSCO"));
$('#modal').dialog('close');
},
altClass: 'tableCol2',
altRows: true,
autosearch:true,
search:true,
scroll: 1,
jsonReader : { root: 'rows', page: 'page', total: 'total' , records: 'records' }
});
$('#list2').setGridParam( { search:true});
jQuery("#list2").jqGrid('navGrid','#pager2',{edit:false,add:false,del:false,search:false,refresh:false});
jQuery("#list2").jqGrid('navButtonAdd',"#pager2",{caption:"Toggle",title:"Toggle Search Toolbar", buttonicon :'ui-icon-pin-s',
onClickButton:function(){
mygrid[0].toggleToolbar()
}
});
jQuery("#list2").jqGrid('navButtonAdd',"#pager2",{caption:"Clear",title:"Clear Search",buttonicon :'ui-icon-refresh',
onClickButton:function(){
mygrid[0].clearToolbar()
}
});
jQuery("#list2").jqGrid('filterToolbar', {gridModel:true , autosearch:true});
//$("#list2").triggerToolbar();
jQuery("#list2")[0].triggerToolbar();
}
The triggerToolbar was the last attempt, but there is no change (and I dont see the additional request made to the server...)
Please help
Most Users Ever Online: 715
Currently Online:
37 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