EasyUI Forum

General Category => General Discussion => Topic started by: wonderone on January 07, 2014, 08:46:05 PM

Title: EasyUI datagrid in iFrame can't display records in first click loading or IE
Post by: wonderone on January 07, 2014, 08:46:05 PM
I have one iFrame which include the datagrid in my JSP page, the iFrame will show only by clicking the tab.

The problem is that when I click the Announcement Tab to show the iFrame, the databrid only shows the pagination bar, no records displayed.

When I click the refresh or next page button, the data will display.

I debuged and found that, the datagrid was rendered.

The main page was like below:
<%@ page contentType="text/html; charset=utf-8"%>
    <script type="text/javascript" src="<%=request.getContextPath()%>/StaticResource/jslib/jquery-easyui-1.3.4/jquery-1.8.0.min.js"></script>
      <style type="text/css">
            width:770px; height:740px;border: 0px solid black;

            width:600px; height:42px; margin:0; padding:0;}
        .tabNav_sq li{float:left; height:42px;margin-right:5px;}

         .tabNav_sq li a{display:block;float:left; width:120px;height:42px; line-height:42px; position:relative; z-index:2;text-align:center;
                  color:#333;cursor:pointer; border:1px solid #fead21; border-bottom:0; font-weight:bolder; font-size:14px;
                  background: #fff;
                  background: -moz-linear-gradient(top, #feda98 0%, #fff4e0 100%);/* FF3.6 */
                  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#feda98), color-stop(100%,#fff4e0));
                  background: -webkit-linear-gradient(top, #feda98 0%,#fff4e0 100%); /* Chrome 10+, Saf5.1+ */
                  background: -o-linear-gradient(top, #feda98 0%,#fff4e0 100%); /* Opera 11.10+ */
                  background: -ms-linear-gradient(top, feda98 0%,#fff4e0 100%);/* IE10 */
                  background: linear-gradient(top, #feda98 0%,#fff4e0 100%);
        function show(){

    <div id="wrapper">
       <div class="tpaicWebAlipay fl w800">
            <div class="tab_containerfix cb mt15">
                 <div class="tabNavWrap">
                    <ul class="tabNav_sq">
                         <li><a href="javascript:void(0);" ><span>Line data</span></a></li>
                         <li><a href="javascript:void(0);" onclick="show();"><span>Announcement</span></a></li>
                 <div style="display:none;">
                 <div  id="ann" class="b-gray lh200 tabCont" style="display:none;">
                     <div class="div_style">
                        <iframe id="announcementForm" name="announcementForm"  width="100%" height="100%"  frameborder="0" scrolling="no"

the /system/announcement/home_list.do request will direct to the page like below:

<%@ page language="java" contentType="text/html; charset=utf-8"
<!DOCTYPE html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css"
<link rel="stylesheet" type="text/css"
<script type="text/javascript"
<script type="text/javascript"
<script type="text/javascript"
                pageList : [ 10, 20, 30, 40, 50],  
                loadMsg: 'Loading...,wait!',
                onLoadSuccess:function(e) {
                    var a = 'aa';
            var b = "ccc";
<body style="width:100%;heighgt:300px;overflow:auto;">
        <div style="position:relative; overflow:auto;">
            <table id="dg" title="Announcement Show">

All worked perfectly good for chrome, this problem only happened in IE. Can anyone tell me why and the workaround for this.

The result is like below screenshots.

I also found that, when the main page was first loaded, there is no element for $(".datagrid-view2 .datagrid-body"). After I click the "announcement tab", the element for $(".datagrid-view2 .datagrid-body") exists. I wonder why it not display when it exists. And in chrome browser, this element exists when the main page first loaded.

I don't know if it is a bug for EasyUI to handle browser compatibility.


Title: Re: EasyUI datagrid in iFrame can't display records in first click loading or IE
Post by: pjobbins on January 20, 2021, 04:20:17 PM
For anyone who stumbles upon this post (as I did).  I had a very similar problem recently; an accordion where each panel linked to a page containing a datagrid.  When expanding any accordion panel in IE the panel would be blank.  Collapsing then re-expanding the panel and the datagrid would be displayed.  This only happened for IE.  Edge, Chrome, Firefox and Safari all worked fine; i.e. the grid would be displayed the first time the panel was expanded.

My solution was to hook into the panels onLoad() event and call the panels resize() method.  This seems to trigger the redraw of the panel and thus shows the grid (NB I tried refresh() but this did not work).  Also the onLoad() event only gets called once (per panel), not every time I expand it.  There does not appear to be any adverse affects in the other browsers.

function fixForIE(id) {
  $('#aa').accordion('getPanel', id - 1).panel('resize');

$(document).ready(function () {

  for (var group in productGroups) {

    var p = $('#aa').accordion('add', {
      title: group + '<span style=\'float:right;margin-right:10px;\'>' + productGroups[group].length + '</span>',
      content: '<div style="padding:10px"></div>',
      selected: false

    $('#aa').accordion('getPanel', $('#aa').accordion('panels').length - 1).panel({
      id: $('#aa').accordion('panels').length,
      href: 'Products?index=' + ($('#aa').accordion('panels').length - 1),
      onLoad: function () { fixForIE(parseInt(this.id)); }



I am using jQuery 3.5.1 and jQuery EasyUI 1.9.7