【问题标题】:How to bind web service in jquery easy ui CRUD DataGrid如何在 jquery easy ui CRUD DataGrid 中绑定 Web 服务
【发布时间】:2013-03-18 05:05:14
【问题描述】:

我正在使用 jQuery EasyUI CRUD 数据网格在 c# asp.net 中开发一个网站。 但是我需要用我的网络服务替换 .php 文件来绑定数据网格,如下面的 sn-p。请建议我这样做。

 <table id="dg" title="My Users" style="width:700px;height:250px"  
            toolbar="#toolbar" pagination="true" idField="id"  
            rownumbers="true" fitColumns="true" singleSelect="true">  
        <thead>  
            <tr>  
                <th field="firstname" width="50" editor="{type:'validatebox',options:{required:true}}">First Name</th>  
                <th field="lastname" width="50" editor="{type:'validatebox',options:{required:true}}">Last Name</th>  
                <th field="phone" width="50" editor="text">Phone</th>  
                <th field="email" width="50" editor="{type:'validatebox',options:{validType:'email'}}">Email</th>  
            </tr>  
        </thead>  
    </table>  

<script type="text/javascript">  
        $(function(){  
            $('#dg').edatagrid({  
                url: 'get_users.php',  
                saveUrl: 'save_user.php',  
                updateUrl: 'update_user.php',  
                destroyUrl: 'destroy_user.php'  
            });  
        });  
    </script>  

【问题讨论】:

    标签: c# jquery asp.net web-services jquery-easyui


    【解决方案1】:

    您可以使用 jQuery Ajax 和 jTemplate。

    $.ajax({
        url: "Your webservice path",
        type: "POST",
        data: "JSON formated data to pass in the webservice",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        cache: false,
        success: function (data) {
           //You can further use jTemplate to output the data.
        },
        error: function (data) {
        }
    });
    

    以下链接显示了 jTemplate 的一个简单示例: http://www.codeproject.com/Articles/45759/jQuery-jTemplates-Grid

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-09-22
      • 1970-01-01
      • 2013-04-10
      • 1970-01-01
      • 1970-01-01
      • 2014-09-12
      • 2014-10-17
      相关资源
      最近更新 更多