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_Related Related Topics sp_TopicIcon
coloptions with editType select with dataUrl as parameter bug..
26/10/2010
12:08
Avatar
mikesmith
Member
Members
Forum Posts: 47
Member Since:
26/01/2010
sp_UserOfflineSmall Offline

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

31/10/2010
15:47
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

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.

02/11/2010
13:52
Avatar
mikesmith
Member
Members
Forum Posts: 47
Member Since:
26/01/2010
sp_UserOfflineSmall Offline

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!

04/11/2010
14:45
Avatar
mikesmith
Member
Members
Forum Posts: 47
Member Since:
26/01/2010
sp_UserOfflineSmall Offline

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(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===

"function"

?true:false,k=typeof a.afterShowForm==="function"?true:false,l=typeof a.afterSubmitForm==="function"?true:false,e=c.p.id,d="ColTbl_"+e,f={themodal:"colmod"+e,modalhead:"colhd"+e,modalcontent:"colcnt"+e,scrollelm:d};a.recreateForm===true&&b("#"+f.themodal).html()!=null&&b("#"+f.themodal).remove();if(b("#"+f.themodal).html()!=null){j&&a.beforeShowForm(b("#"+d));viewModal("#"+f.themodal,{gbox:"#gbox_"+e,jqm:a.jqModal,jqM:false,modal:a.modal})}else{var g=isNaN(a.dataheight)?a.dataheight:a.dataheight+

18/11/2010
16:14
Avatar
mikesmith
Member
Members
Forum Posts: 47
Member Since:
26/01/2010
sp_UserOfflineSmall Offline

Hi Tony

Any ideas about this?  could it be a plugin issue?

thanks again for your assistance.

18/11/2010
18:16
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Hi mikesmith,

You can change the recreateForm option to true for example with the following JavaScript code fragment:

jQuery.extend(jQuery.jgrid.edit, {recreateForm: true});

Best regards
Oleg 

29/11/2010
20:53
Avatar
mikesmith
Member
Members
Forum Posts: 47
Member Since:
26/01/2010
sp_UserOfflineSmall Offline

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.

Forum Timezone: Europe/Sofia

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.com

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

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information