EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: Opan Mustopah on March 25, 2015, 10:29:18 PM



Title: extend load method in combogrid
Post by: Opan Mustopah on March 25, 2015, 10:29:18 PM
hello again,

i have a little problem about extending new mthod on combogrid plugins.

i want to extend load datagrid method into combogrid.
here is what i doing so far:

Code:
$.extend($.fn.combogrid.methods, {
    LoadQueryParams: function(jq, param){
      return jq.each(function(){
        var grid = $(this).combogrid('grid');
        var opts = $(this).combogrid('options');
        console.log(opts);
        var queryParams = opts.queryParams;
        var params = $.extend(queryParams, param);
        console.log(queryParams);
        // var params = $.extend(opts.queryParams, param);
        console.log(params);
        // delete opts.queryParams;
        grid.datagrid('load',params);
        opts.queryParams = params;
        console.log(opts);
      });
    }
  });


i want to change queryParams too when i used this method.
but the result not like i expected. when i try console , queryParams object value is not same when i set using this method.?
when i try to using this method in some combogrid, for example $('#cb1').combogrid('LoadQueryParams',{test:'1'});
but when i try debug in second combogrid, $('#cb2'), parameter test: '1' is exist too.

how to apply a new properties without override existing element ? so it's just like ordinary method.

many thanks for the answer.