I have a datatable that loads data only on browser button refresh. When the view is activated using code, it displays no data. This happens for a list as well.
Please help.
I have a datatable that loads data only on browser button refresh. When the view is activated using code, it displays no data. This happens for a list as well.
Please help.
Hello,
are you using load method for data loading ? Could you provide a snippet that shows loading approach ?
define([],function(){
Hello Maria,
I am not using load method. My table has static data.
The contents of my start.js are as follows:
var offers = [
{id:1, direction:"<b>Tallin</b> EE - <b>Berlin</b> Tegel DE", date:new Date(2014,7,25), price:"450", save:"45", places:21},
{id:2, direction:"<b>Moscow</b> Vnukovo RU - <b>Kiev</b> Borispol UA", date: new Date(2014,7,28), price:"160", save:"65", places:5},
{id:3, direction:"<b>Riga</b> International LV - <b>Warsaw</b> Modlin", date: new Date(2014,7,16), price:"220", save:"110", places:2},
{id:4, direction:"<b>Vilnius</b> LT - <b>Kiev</b> Zhulhany UA", date: new Date(2014,8,1), price:"140", save:"40", places:35},
{id:5, direction:"<b>Minsk</b> International 2 BY- <b>Berlin</b> Schoenefeld DE", date: new Date(2014,8,6), price:"378", save:"35", places:25}
];
var special_offers = {
gravity:3,
rows:[
{
id: "sOffers",
view: "datatable", select:true,
columns:[
{id:"id", header:"#", width:40},
{id:"direction", header:"Direction", fillspace:true},
{id:"date", header:"Date", width:150, sort:"date", format:webix.i18n.longDateFormatStr},
{id:"price", header:"Price", width:95, sort:"int", format:webix.i18n.priceFormat},
{id:"save", header:"You save", width:95, sort:"int", format:webix.i18n.priceFormat},
{id:"places", header:"Tickets", width:65, sort:"int"},
{id:"book", header:"Booking", css:"webix_el_button", width:100, template:"<a href='javascript:void(0)' class='check_flight'>Book now</a>"}
],
data:offers
}
]
};
return {
$ui:special_offers
}
});
Thanks,
Hamisi
Hello Maria,
I made a mistake in pasting. I meant to say that I am not using load method. My table has static data.
The contents of my start.js are as follows:
define([],function(){
var offers = [
{id:1, direction:"<b>Tallin</b> EE - <b>Berlin</b> Tegel DE", date:new Date(2014,7,25), price:"450", save:"45", places:21},
{id:2, direction:"<b>Moscow</b> Vnukovo RU - <b>Kiev</b> Borispol UA", date: new Date(2014,7,28), price:"160", save:"65", places:5},
{id:3, direction:"<b>Riga</b> International LV - <b>Warsaw</b> Modlin", date: new Date(2014,7,16), price:"220", save:"110", places:2},
{id:4, direction:"<b>Vilnius</b> LT - <b>Kiev</b> Zhulhany UA", date: new Date(2014,8,1), price:"140", save:"40", places:35},
{id:5, direction:"<b>Minsk</b> International 2 BY- <b>Berlin</b> Schoenefeld DE", date: new Date(2014,8,6), price:"378", save:"35", places:25}
];
var special_offers = {
gravity:3,
rows:[
{
id: "sOffers",
view: "datatable", select:true,
columns:[
{id:"id", header:"#", width:40},
{id:"direction", header:"Direction", fillspace:true},
{id:"date", header:"Date", width:150, sort:"date", format:webix.i18n.longDateFormatStr},
{id:"price", header:"Price", width:95, sort:"int", format:webix.i18n.priceFormat},
{id:"save", header:"You save", width:95, sort:"int", format:webix.i18n.priceFormat},
{id:"places", header:"Tickets", width:65, sort:"int"},
{id:"book", header:"Booking", css:"webix_el_button", width:100, template:"<a href='javascript:void(0)' class='check_flight'>Book now</a>"}
],
data:offers
}
]
};
return {
$ui:special_offers
};
});
For the error.
Thanks,
Hamisi
Hello! Seems strange, but for me your code works correctly
Hello Listopad,
Thanks for the response. I am not sure why I am having this issue. And I cannot continue with my project.
Hi Hamisi,
could you please check whether the data exists in your datatable?
$$("sOffers").count();
and the height of your datatable (data may have been loaded but not visible due to improper sizing):
$$("sOffers").$height;