EasyUI Forum
November 04, 2025, 11:53:33 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: [Codeigniter, Ajax, EasyUI] load PHP-Page with HTML into Div  (Read 20199 times)
Konitzer
Newbie
*
Posts: 2


View Profile Email
« on: July 04, 2014, 02:56:58 AM »

Hallo Community,

At first i will say my englich is not so good, i hope you excuse me.

I have an existing Codeigniter, Ajax and EasyUI Projekt and then i must adjust it. Im new in this topic and don't found a post to my problem into the internet. Then i hope you can help me.

To my problem.
I will post a PHP-View with HTML-Code and EasyUI-Code into a Div in my Main-Page. But the EasyUI Datagrid dosn't show and the javascript methode  $(document).ready(function()) dosn't call too. When i show the PHP-View it show me the Datagrid-Component.

My Code:
The Div in my Main-Page
Code:
<div title="Karten" style="overflow:auto;padding:10px;">
   <div id="kartenan"></div>
</div>

The Javascript-Code to post the PHP-View into the div
Code:
// load Karten-Datagrid
$.post(
'<?php echo base_url(); ?>index.php/ajax/datagrid_kartenliste/' + id,false,
      function success(html){
          $('#kartenan').html(html);
      }
);

The Ajax-Method datagrid_kartenliste
Code:
public function datagrid_kartenliste($id) {		
    $this->load->view('kartenliste',array(
   "base_url" => base_url(),
    ));
}

The PHP-View 'kartenliste.php'
Code:
<html>
    <head>
        <title>Kartenliste</title>

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

        <link rel="stylesheet" type="text/css" href="<?php echo $base_url?>application/views/easyui/themes/default/easyui.css">

        <script type="text/javascript" src="<?php echo $base_url?>application/views/easyui/jquery-1.8.0.min.js"></script>
        <script type="text/javascript" src="<?php echo $base_url?>application/views/easyui/jquery.easyui.min.js"></script>
        <script type="text/javascript" src="<?php echo $base_url?>application/views/easyui/datagrid-detailview.js"></script>
        <script type="text/javascript" src="<?php echo $base_url?>application/views/easyui/jquery.edatagrid.js"></script>
        <script type="text/javascript" src="<?php echo $base_url?>application/views/easyui/datagrid-groupview.js"></script>
    </head>

    <body>
<div region="center" style="height:200px; width:265px;">
   <div region="center" style="height:180px; width:265px;">
<table id="dgkart" class="easyui-datagrid"
data-options="
singleSelect: true,
fitColumns:true,
url: '<?php echo base_url(); ?>index.php/ajax/datagrid_left',
onClickRow: enable_button_karte
">
    <thead>
<tr>
    <th field="idanzeige" width="35px">ID</th>
    <th field="nr" width="98px">Nr</th>
    <th field="pin" align="center" width="37px">PIN</th>
    <th field="puk" align="right" width="90px">PUK</th>                                     
</tr>
    </thead>
</table>
           </div>

           <a id="btka" class="easyui-linkbutton">Neu</a>
           <a id="btkb" class="easyui-linkbutton">Bearbeiten</a>
       </div>
    </body>

    <script type="text/javascript">
         var editIndex = undefined;
         var detailID = undefined;

         $(document).ready(function() {
      alert("Test")
         });
    </script>
</html>

The easy-linkbutton are show, but not the datagrid and not the alert into the $(document).ready(function())

I hope you can help me.
Logged
jarry
Administrator
Hero Member
*****
Posts: 2300


View Profile Email
« Reply #1 on: July 04, 2014, 03:48:03 AM »

The simplest way to load external page content is to use the 'refresh' method of panel. Define a panel as:
Code:
<div title="Karten" style="overflow:auto;padding:10px;">
   <div id="kartenan" class="easyui-panel"></div>
</div>
In order to load the page 'kartenliste.php', call 'refresh' method.
Code:
$('#kartenan').panel('refresh', url);

Here is the example shows how to load the page content into a panel.
http://www.jeasyui.com/demo/main/index.php?plugin=Panel&theme=default&dir=ltr&pitem=Load%20Content
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!