w2ui scroll columns
HTML
<script src="https://rawgit.com/vitmalina/w2ui/master/dist/w2ui.min.js"></script>
<link rel="stylesheet" href="https://rawgit.com/vitmalina/w2ui/master/dist/w2ui.css">
<div id="grid" style="width: 100%; height: 350px;"></div>
JavaScript
$('#grid').w2grid({
name: 'grid',
show: {
lineNumbers: true,
toolbar: true,
footer: true,
toolbarReload: true,
toolbarColumns: false
},
columns: [
{
"field": "FechaAlbaran",
"caption": "Mes",
"size": 100,
"min": "100",
"sortable": true,
"resizable": true
},
{
"field": "2000",
"caption": "2000",
"size": "130px",
"attr": "align=center",
render: function (record, index, column_index) {
var html = "";
var rowStyle = "";
var fieldName = this.columns[column_index].field;
var item = record[fieldName];
if (item.toString().indexOf("-") !== -1) {
rowStyle = "style='color: red; font-weight:bold;'";
}
html = "<span " + rowStyle + ">" + item + "</span>";
return html;
}
},
{
"field": "2001",
"caption": "2001",
"size": "130px",
"attr": "align=center",
render: function (record, index, column_index) {
var html = "";
try {
var rowStyle = "";
var fieldName = this.columns[column_index].field;
var item = record[fieldName];
if (item.toString().indexOf("-") !== -1)
rowStyle = "style='color: red; font-weight:bold;'";
html = "<span " + rowStyle + ">" + item + "</span>";
}catch (e) {
console.error(record);
console.error(index);
console.error(column_index);
}
return html;
}
},
{
"field": "2002",
"caption": "2002",
"size": "130px",
...