Closed mkharibalaji closed 4 years ago
the same issue here, the property returns NULL.
Hi,
Sorry for the late reply... Thanks for using this module.
Can you activate the debug on the plugin and send me the trace please. I'll see why it does not retrieve the data
Regards,
Is it still an issue ?
Hi , First of all a big thanks for your great work.We are currently working on a project in which we use Express 4 mongoose : 4.1.1 mongoose-datatable : 1.0.4
var company = new Schema({ company_name : String, owner_first_name : String, owner_last_name : String, register_date : Date, company_license_no : String, company_addr1 : String, company_addr2 : String, company_addr3 : String, company_pin : Number, company_city : String, company_state: String, company_status : String, company_value : String, company_type : String, parent_company_id : String, createdby : String, createddate : Date, modifiedby : String, modifieddate : Date },{collection:'fms_company'});
var zone = new Schema({ zone_name : String, zone_description : String, createdby : String, createddate : Date, modifiedby : String, modifieddate : Date },{collection:'fms_zone'});
var zoneDeliveryCharge = new Schema({ company_id : [{ type: Schema.ObjectId, ref: 'Company' }], zone_id : [{ type: Schema.ObjectId, ref: 'Zone' }], delivery_charge : Number, delivery_description : String, createdby : String, createddate : Date, modifiedby : String, modifieddate : Date },{collection:'fms_zone_delivery_charge'});
I have created a DataTable for zoneDeliveryCharge Schema as follows,
var zoneDeliveryChargeListTable = $('#zoneDeliveryChargeList').DataTable( { "processing" : true, "serverSide" : true, "responsive" : true,
"ajax" : { "url": 'xxxxxx/list', "data": function ( d ) {d.srch_company_id = $("#editCompanyID").val();} }, "columns": [ { "data": "zone_id.zone_name" }, { "data": "delivery_charge" }, { "data": "delivery_description" }, { "class":"details-control text-center", data: null, defaultContent: ' ', orderable: false }], "order": [[1, 'asc']] });
When I try to access populated value,I get nothing, var options = { conditions : { "company_id" : companyID} }; zoneDeliveryChargeModel.dataTable(req.query,options, function (err, data) { res.send(data); });
{"draw":"1","recordsTotal":2,"recordsFiltered":2,"data":[{"_id":"55d952af8cbfad3a05f8323a","delivery_description" :"XXXXXXXX","delivery_charge":100,"zone_id":[]},{"_id":"55d964354df324fc05930182","delivery_description" :"XXXXXXX","delivery_charge":200,"zone_id":[]}]}
I am getting zone_id always empty and don't finad any data getting populated into it.Is it something that I am doing wrong/missing. Or is it a bug ?
It would be better if you could provide a good example for populating refType....
Thanks & regards, Hari