如何使用PHP codeigniter和AJAX编辑数据网格?

时间:2015-09-07 12:55:54

标签: jquery html ajax codeigniter

对于我想直接在用户列表上编辑用户的系统。看到我有一个页面,我获取所有用户。现在一个系统可能有很多用户,所以我不想打开每个用户并编辑他。相反,我想使用jquery或ajax创建一个GUI,允许我直接编辑用户列出他的位置。我的意思是我点击用户然后它应该变成文本框,让我编辑细节,并保存返回。以下是我获取所有用户的代码:

<?php $this->load->view('admin/components/page_head') ?>
    <section class="container-fluid">
    <ul class="nav nav-pills">  <li class="active"> <h2><i class="glyphicon glyphicon-user"></i>&nbsp Resellers&nbsp<span class="badge"><?php echo $this->db->count_all('reseller');?></span></h2></li></ul>


    <h3>    <?php echo anchor('admin/reseller/edit', '<i class="glyphicon glyphicon-plus"></i> Add a Reseller'); ?></h3>

        <table class="table table-primary">
            <thead>
                <tr>

                    <th>SIP Userid</th>
                    <th>SIP Password</th>
                    <th>Unique ID</th>
                    <th>Allocation_block</th>
                    <th>Intial Users Required</th>
                    <th>User Name</th>
                    <th>Status</th>
                    <th>Country</th>
                    <th>Country Code</th>
                    <th>Email</th>
                    <th>Phone</th>
                    <th>Balance</th>    
                    <th>Edit</th>
                    <th>Delete</th>


                </tr>
            </thead>
            <tbody>
    <?php if(count($users)): foreach($users as $user): ?>   
            <tr>

                <td><?php echo anchor('admin/reseller/my_users/' . $user->id, $user->sip_username); ?></td>
                <td><?php echo anchor('admin/reseller/edit/' . $user->id, $user->sip_password); ?></td>
                <td><?php echo anchor('admin/reseller/edit/' . $user->id, $user->key); ?></td>
                <td><?php echo anchor('admin/reseller/edit/' . $user->id, $user->allocation_block); ?></td>
                <td><?php echo anchor('admin/reseller/edit/' . $user->id, $user->user_num); ?></td>
                <td><?php echo anchor('admin/reseller/edit/' . $user->id, $user->name); ?></td>
                <td><?php echo anchor('admin/reseller/edit/' . $user->id, $user->status); ?></td>
                <td><?php echo anchor('admin/reseller/edit/' . $user->id, $user->country_code); ?></td>
                <td><?php echo anchor('admin/reseller/edit/' . $user->id, $user->country); ?></td>
                <td><?php echo anchor('admin/reseller/edit/' . $user->id, $user->email); ?></td>
                <td><?php echo anchor('admin/reseller/edit/' . $user->id, $user->phone); ?></td>
                <td><?php echo anchor('admin/reseller/edit/' . $user->id, $user->balance); ?></td>


                <td><?php echo btn_edit('admin/reseller/edit/' . $user->id); ?></td>
                <td><?php echo btn_delete('admin/reseller/delete/' . $user->id); ?></td>
            </tr>
    <?php endforeach; ?>
    <?php else: ?>
            <tr>
                <td colspan="3">We could not find any users.</td>
            </tr>
    <?php endif; ?> 
            </tbody>
        </table>
    </section>
    <?php $this->load->view('admin/components/page_tail') ?>

0 个答案:

没有答案