How to use Meteor collections in datatable (meteor-webix-adminapp)

edited May 16 in Technical questions

Hi,

I downloaded this project and want to use it: https: //github.com/baysao/meteor-webix-adminapp but there is no example of how to use it with meteor collections. I tried to use it as follows but it does not work;

var grid = {
    id:"productsData",
    view:"datatable", select:true, editable:true, editaction:"dblclick",
    columns:[
        {id:"id", header:"#", width:50},
        {id:"code", header:["Code", {content:"textFilter"} ], sort:"string", minWidth:80, fillspace: 1},
        {id:"name", header:["Name", {content:"textFilter"} ], sort:"string", minWidth:120, fillspace: 2, editor:"text"},
        {id:"categoryName", header:["Category", {content:"selectFilter"} ], sort:"string", minWidth:120, fillspace: 2, editor:"select",  template:"<div class='category#category#'>#categoryName#</div>"},
        {id:"price", header:["Price"], sort:"int", minWidth:80, fillspace: 1, format:webix.i18n.priceFormat},
        {id:"quantity", header:["Quantity" ], sort:"int", minWidth:60, fillspace: 1},
        {id:"statusName", header:["Status"], minWidth:75, sort:"string", minWidth:70, fillspace: 1, template:"<span class='status status#status#'>#statusName#</span>"},

        {id:"edit", header:"&nbsp;", width:35, template:"<span  style=' cursor:pointer;' class='webix_icon fa-pencil'></span>"},
        {id:"delete", header:"&nbsp;", width:35, template:"<span  style='cursor:pointer;' class='webix_icon fa-trash-o'></span>"}
    ],
    pager:"pagerA",
    "export":true,
    url:webix.proxy('meteor', Books),
    save:webix.proxy('meteor', Books),

    onClick:{
        "fa-trash-o":function(e,id,node){
            webix.confirm({
                text:"The product will be deleted. <br/> Are you sure?", ok:"Yes", cancel:"Cancel",
                callback:function(res){
                    if(res){
                        var item = webix.$$("productsData").getItem(id);
                        item.status = "0";
                        item.statusName = "Deleted";
                        webix.$$("productsData").refresh(id);
                    }
                }
            });
        }
    },
    ready:function(){
        webix.extend(this, webix.ProgressBar);
    }
};
Tagged:
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!