我有谷歌可视化数据表和工作良好,但我的问题是与宽度的表。 当我单击我在图像上显示时,我调用函数drawTable();然后我得到这个:响应谷歌可视化数据表
,正如你所看到的表不具有宽度:100%;
但是当我再次点击“Mehanizacija”,你可以在照片上看到我再次调用函数drawTable();然后是一切OK:
那么,什么是数据表宽度的问题...为什么我需要调用函数两次drawTable()很好地工作?有什么办法解决这个问题?所以只需一个clikc就可以获得宽度为100%的数据...?
这里是我的功能drawTable();
:
function drawTable() {
// Create and populate the data table.
var JSONObject = $.ajax({
url: 'call_radnici.php', // make this url point to the data file
dataType: 'json',
data:{ajdi:ajdi},
async: false,
type: 'POST',
}).responseText;
var data = new google.visualization.DataTable(JSONObject, 0.5);
data.addColumn('string', '');
for (var y = 0, maxrows = data.getNumberOfRows(); y < maxrows; y++) {
var mc = data.getNumberOfColumns()-1;
data.setValue(y, mc, '<div data-toggle="tooltip" data-placement="top" title="Delete this day data"><i class="fa fa-trash-o" ></i></div>');
}
var table = new google.visualization.Table(document.getElementById('tplradnici'));
table.draw(data, {'allowHtml': true, cssClassNames: {
'headerRow': 'zaglavlje1',
'tableRow': 'red',
'oddTableRow': 'red',
'selectedTableRow': 'orange-background large-font',
'hoverTableRow': 'prekoreda',
'headerCell': 'gold-border',
'tableCell': 'cell',
'rowNumberCell': 'underline-blue-font'}
});
};