2012-02-07 14 views
1

私のページには多数のjqgridがあります。ポップアップ警告モーダルウィンドウ(「警告を選択してください」)が常に上部に表示されます。編集イベントが生成されたJQGridの横に、モーダルウィンドウが表示されるようにしました。 これを動作させる唯一の方法は、JQGridのソースコードを次のように変更することでした。AlertMod警告メッセージのJQGridの位置

//Line number 7866 
if (o.edit) { 
    tbd = $("<td class='ui-pg-button ui-corner-all'></td>"); 
    pEdit = pEdit || {}; 
    $(tbd).append("<div class='ui-pg-div'><span class='ui-icon "+o.editicon+"'></span>"+o.edittext+"</div>"); 
    $("tr",navtbl).append(tbd); 
    $(tbd,navtbl) 
    .attr({"title":o.edittitle || "",id: pEdit.id || "edit_"+elemids}) 
    .click(function(){ 
     if (!$(this).hasClass('ui-state-disabled')) { 
      var sr = $t.p.selrow; 
      if (sr) { 
       if($.isFunction(o.editfunc)) { 
        o.editfunc(sr); 
       } else { 
        $($t).jqGrid("editGridRow",sr,pEdit); 
       } 
      } else { 
       $.jgrid.viewModal("#"+alertIDs.themodal,{gbox:"#gbox_"+$t.p.id,jqm:true}); 

       //*********** 
       //Added this to change the location of the Warning Alert window 
       //Line number 7883 
       $("#alertmod")[0].style.top =$("#gbox_"+$t.p.id)[0].offsetTop; 
       //*********** 

       $("#jqg_alrt").focus(); 
      } 
     } 
     return false; 

これを実現するには、srcコードを変更しないと簡単な方法がありますか?

答えて

0

は、それはあなたが望むもののための1つの代替することができますjqGrid warning please select row position

この回答を参照してください。

var orgViewModal = $.jgrid.viewModal; 
$.extend($.jgrid,{ 
    viewModal: function (selector,o){ 
     if(selector == '#alertmod'){ 
      var of = jQuery(o.gbox).offset();  
      var w = jQuery(o.gbox).width();  
      var h = jQuery(o.gbox).height(); 
      var w1 = $(selector).width(); 
      var h1 = $(selector).height(); 
      $(selector).css({ 
       'top':of.top+((h-h1)/2), 
       'left':of.left+((w-w1)/2) 
      }); 
     } 
     orgViewModal.call(this, selector, o); 
    } 
}); 
関連する問題