解决方案 »

  1.   

    $('#xxxx').datagrid('reload');如果是加载数据配置好url就好了,多看下示例,看需要什么格式的数据,php就输出什么格式的数据
      

  2.   

    使用easyui-grid控件的updateRow方法进行指定行的更新来达到局部更新的作用$('#dg').datagrid('updateRow',{
    index: 2,
    row: {
    name: 'new name',
    note: 'new note message'
    }
    });其row的数据由ajax请求得到   再使用该方法去局部更新,其他详情自己看官方doc
      

  3.   

    在进行一个小测试时遇到个问题,开始时url是xx.php, xx.php获取数据后以json输出结果。
    echo json_encode($result);
    <table id="best_list"  class="easyui-datagrid" style="width:720px;height:auto" title="Best_list"
     data-options=" url: ‘xx.php’, singleSelect: true,  rownumbers:true "         
     > 
    现在我用个方法输出同样的json结果,该怎么用这个方法替换掉以前url中的.php文件?
    <?php 
    include_once 'get_bestlist.php';
    $getbest = new getBestList();
    ?>
    <table id="best_list"  class="easyui-datagrid" style="width:720px;height:auto" title="Best_list"
     data-options=" url: <?php $getbest->initBestList() //这个方法将输出个json对象?>, singleSelect: true,  rownumbers:true "         
     > 
      

  4.   

    xx.php输出html?输出这个干吗,又不是datagrid需要的数据。如果你要修改条件,可以用load方法,新增加你的参数就行了Load and show the first page rows. If the 'param' is specified, it will replace with the queryParams property. Usually do a query by passing some parameters, this method can be called to load new data from server.$('#dg').datagrid('load',{
    code: '01',
    name: 'name01'
    });
      

  5.   

    xx.php就是输出一个json数据,用来初始化datagrid。
    <table id="best_list"  class="easyui-datagrid" style="width:720px;height:auto" title="Best_list"
     data-options=" pagination:true, url: 'get_GlobalNetwork.php', singleSelect: true,  rownumbers:true "      
     > 
    <thead> 
    <tr>
    因为页面有很多datagrid如果每一个datagrid都要一个.php为它初始化提供数据源就显得很臃肿。 所以我想用个输出json格式数据的方法来代替。怎么写这个url?
    ---------------------------------当查询条件改变后,点击‘go’按钮,怎么用根据新的条件用ajax刷新下面对应的datagrid里的数据?
    希望能用个小小demo说明下
      

  6.   

    #4不是说了,load方法,传递你的查询参数啊$('#best_list').datagrid('load',{//注意改选择器
        region: $('#region').val(),
        brand: $('#brand').val(),
        date: $('#date').val()
    });