Forum
12:08
26/01/2010
If you have a column which is of editType select and has a dataUrl as a parameter when selecting an already selected row, the ajax request fires again.
Since the row is already selected, this should not execute that ajax request again. If you change the setting the options value as a String or setting the options value as an object, there is no problem.
See: http://www.trirand.com/jqgridw.....s#edittype
For dataUrl, it means an extra call is made when it is not needed. Remember the row is already selected, so if we select the same row again, no need to execute calls as we already have the data loaded in the grid.
thanks
15:47
Moderators
30/10/2007
Hello,
Please post the grid and navgrid configuration. It seems you have set recreateForm option to true.
Regards
Tony
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.
13:52
26/01/2010
Hi Tony
I am using the strut2-jqueryplugin (http://code.google.com/p/struts2-jquery/) I wonder if this settingyou are talking about needs to be altered in this plugin. Anyway, here is an example of how I structure my grids which cause this issue:
<script type="text/javascript">
var lastsel;
/**
* Overwrites default from plugin.
*/
$.subscribe('rowSelectSubLocation', function(){
var id = jQuery("#subLocationGrid").jqGrid('getGridParam','selrow');
if(id && id!==lastsel){
jQuery("#subLocationGrid").jqGrid('restoreRow',lastsel);
jQuery("#subLocationGrid").jqGrid('editRow',id,true,null,successFuncStandardGrid);
lastsel=id;
}
});
function successFuncStandardGrid(data){
var message = JSON.parse(data.responseText).message;
return displayMessage(message, 'messageDiv');
}
</script>
<s:url id="locationListUrl" action="retrieveLocationListForProjectURL.action" namespace="/emp"/>
<s:url id="remoteurl" action="retrieveAllSubLocations" namespace="/emp"/>
<s:url id="editurl" action="editSubLocation" namespace="/emp"/>
<sjg:grid
id="subLocationGrid"
caption="%{getText('label.subLocations')}"
dataType="json"
href="%{remoteurl}"
pager="true"
navigator="true"
navigatorSearchOptions="{sopt:['eq','ne','lt','gt']}"
navigatorAddOptions="{height:200,width:400,reloadAfterSubmit:true,closeAfterAdd:true,
afterSubmit:afterAdd, bottominfo:'%{getText('label.mandatory.text')}'}"
navigatorEditOptions="{height:300,width:200,reloadAfterSubmit:true,closeAfterEdit:true}"
navigatorDeleteOptions="{height:100,width:200,reloadAfterSubmit:true}"
navigatorAdd="%{#session.canEdit}"
navigatorEdit="false"
navigatorView="false"
navigatorDelete="%{#session.canEdit}"
navigatorSearch="false"
gridModel="gridModel"
editurl="%{editurl}"
editinline="%{#session.canEdit}"
filter="true"
autoencode="false"
onCompleteTopics="completeSubLocationGrid"
onSelectRowTopics="rowSelectSubLocation"
shrinkToFit="true"
viewrecords="true"
scrollrows="true"
rowNum="200"
rownumbers="true"
width="600"
height="220"
>
<sjg:gridColumn name="subLocation.subLocationName"
index="subLocationNameHeader" title="%{getText('label.subLocation.locationName')}"
editable="%{#session.canEdit}" edittype="text"
editoptions="{size:40,maxlength:30}" editrules="{required:true}"
formoptions="{elmprefix:'%{getText('label.mandatory')} '}"
sortable="true" search="true" width="300"/>
<sjg:gridColumn name="location.locationName"
index="locationNameHeader" title="%{getText('label.location.locationName')}"
editable="%{#session.canEdit}" edittype="select"
editoptions="{dataUrl : '%{locationListUrl}'}"
editrules="{required:true,custom:true,custom_func:checkPleaseSelect}"
formoptions="{elmprefix:'%{getText('label.mandatory')} '}"
sortable="true" search="true" width="300"/>
</sjg:grid>
Many thanks!
14:45
26/01/2010
I did a search in my workspace for 'recreateForm' and found only 2 instances.
Both in jquery.jqGrid.js.
If I need to override this, how do I go about doing this? many thanks…
function(b){b.jgrid.extend({setColumns:function(a){a=b.extend({top:0,left:0,width:200,height:"auto",dataheight:"auto",modal:false,drag:true,beforeShowForm:null,
afterShowForm:null,afterSubmitForm:null,closeOnEscape:true,ShrinkToFit:false,jqModal:false,saveicon:[true,"left","ui-icon-disk"],closeicon:[true,"left","ui-icon-close"],onClose:null,colnameview:true,closeAfterSubmit:true,updateAfterCheck:false,recreateForm:false},
b.jgrid.col,a||{});return this.each(function(){var c=this;if(c.grid){var j=typeof a.beforeShowForm===
And
"function"
20:53
26/01/2010
Hi Oleg & Tony
Thanks for your response. I tried your suggestions but it didnt work. 🙁
I even tried putting reacreateform: true(as per Tonys suggestion) & also false(as per Olegs suggestion) but this did not fix my problem either.
All my grids use inline edit. And obviously the first time a row is clicked, all the necessary dataURls get tired to load the dropdowns.
I think the struts-jquery plugin I am using sets recreateForm to false. I am wondering does this option only apply for Form Editing?
As far as I can see, for InlineEditing there are no properties that can be set(/jqgridwiki/doku.php?id=wiki:inline_editing) & thus I am thinking that there might not be a way currently when using InlineEditing to stop JqGrid firiing all the colModel options when a row is selected again.
In my example above, when 'rowSelectSubLocation' is called after a row is clicked, if its the same row clicked, I do not call: editRow. Infact it doesnt go into the if statement and just exists the function. Yet, my row is re-populated again by jqGrid. How is this possible? could this be a bug or am I missing something?
Thanks to you and Tony for your expert help.
Most Users Ever Online: 715
Currently Online:
66 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