Skip to content

Commit

Permalink
v1.5.7
Browse files Browse the repository at this point in the history
  • Loading branch information
pphod committed Sep 3, 2018
1 parent 0a9567e commit 8b94721
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 40 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ It is very easy to use jExcel, first you should make you have include the jquery
```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jexcel/1.3.4/js/jquery.jexcel.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jexcel/1.3.4/css/jquery.jexcel.css" type="text/css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jexcel/1.3.7/js/jquery.jexcel.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jexcel/1.3.7/css/jquery.jexcel.css" type="text/css" />
```

You should initiate your table based on a div container, such as:
Expand Down
40 changes: 23 additions & 17 deletions examples/autocomplete.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
<script src="../dist/js/jquery.jexcel.js"></script>
<script src="../dist/js/jquery.jcalendar.js"></script>
<link rel="stylesheet" href="../dist/css/jquery.jexcel.css" type="text/css" />
<link rel="stylesheet" href="../dist/css/jquery.jexcel.green.css" type="text/css" />
<link rel="stylesheet" href="../dist/css/jquery.jcalendar.css" type="text/css" />

<script src="../dist/js/excel-formula.min.js"></script>
<script src="../dist/js/jexcel.js"></script>

</head>
<body>
Expand Down Expand Up @@ -90,8 +90,12 @@

<br>


<div style='position:absolute;'>

<div id="my" style="width:100%"></div>

</div>

<script>
data = [
Expand Down Expand Up @@ -347,31 +351,33 @@
{"name": "Zimbabwe", "id": "ZW"}
];

onload1 = function (instance) {
// Get last header
var lastColumn = $(instance).find('thead td').last();
// Get actual table width
var mainTable = $(instance).find('.jexcel');
// New last header column width
var width = parseInt($(lastColumn).prop('width')) + parseInt($(instance).width() - $(mainTable).width());
// Update width
$(lastColumn).prop('width', width);
}

$('#my').jexcel({
data:data,
nestedHeaders: [
[
{ title: 'All', colspan: 3, width:600 },
],
[
{ title: 'Region', colspan: 2, width:400 },
{ title: 'Status', colspan: 1, width:200 }
],
],
colHeaders: ['Country', 'Food', 'Stock'],
colHeaderClasses: [ 'a1', 'b2', 'c3' ],
colAlignments:[ 'left', 'left', 'left', 'left' ],
colWidths: [ 300, 100, 200 ],
onload:onload1,
columns: [
{ type: 'autocomplete', source:countries },
{ type: 'hidden', source:countries },
{ type: 'dropdown', source:['Apples','Bananas','Carrots','Oranges','Cheese'] },
{ type: 'checkbox' },
{ type: 'text', readOnly:true },
]
],
tableOverflow:true,
tableHeight:100,
onmouseover:function(x, y) {
console.log(x);
console.log(y);
}
});

</script>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions examples/creating-a-table-from-an-external-csv-file.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
csv:'http://cdn.bossanova.uk/demo/demo1.csv',
csvHeaders:true,
colWidths: [70, 200, 300],
tableOverflow:true,
});

$('#download').on('click', function () {
Expand Down
44 changes: 27 additions & 17 deletions examples/including-formulas-on-your-spreadsheet.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,20 +91,27 @@

<div id="my"></div>

<br><br>

<div id="my1"></div>

<script>
function custom(cell)
{
alert(cell);
}

var data = [
['=IF(C1 < 10000, true, false)',1,10000,'=B1*C1'],
['Tower',2,6000,'=B2*C2'],
['Drum',3,5000,'=B3*C3'],
['Pump',4,4000,'=B4*C4'],
['aa',1,10000,'=B1+C1'],
['bbb',2,6000,'=B2+C2'],
['ccc',3,5000,'=B3+C3'],
['ddd',4,4000,'=B4+C4'],
['Total','=SUM(B1:B4)','=(C1+C2+C3+C4)','=SUM(D1:D4)']
];

var data1 = [
['aa',1,10000,'=B1*C1'],
['bbb',2,6000,'=B2*C2'],
['ccc',3,5000,'=B3*C3'],
['ddd',4,4000,'=B4*C4'],
['Total','=SUM(B1:B4)','=(C1+C2+C3+C4)','=SUM(D1:D4)']
]
];

$('#my').jexcel({
data:data,
Expand All @@ -119,14 +126,17 @@
colWidths: [300, 150, 150, 150, 150],
});

$('#my').jexcel('updateSettings', {
cells: function (cell, col, row) {
if (col > 0) {
value = $('#my').jexcel('getValue', $(cell));
val = numeral($(cell).text()).format('0,0.00');
$(cell).html('<input type="hidden" value="' + value + '">' + val);
}
}
$('#my1').jexcel({
data:data1,
columns: [
{ type:'text' },
{ type:'numeric' },
{ type:'numeric' },
{ type:'numeric' },
],
colHeaders: ['Equipment','Quantity', 'Price', 'Total'],
colWidths: [ 400, 100, 200 ],
colWidths: [300, 150, 150, 150, 150],
});
</script>

Expand Down
10 changes: 8 additions & 2 deletions examples/multiple-spreadsheets-in-the-same-page.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,16 @@
var data2 = $.fn.jexcel('helper', { action:'createEmptyData', cols:8, rows:4 });

$('#my1').jexcel({
data:data1
data:data1,
contextMenu:function() {
console.log(1);
}
});
$('#my2').jexcel({
data:data2
data:data2,
contextMenu:function() {
console.log(2);
}
});
</script>

Expand Down
2 changes: 1 addition & 1 deletion jexcel.jquery.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"data-grid",
"data-spreadsheet"
],
"version": "1.5.4",
"version": "1.5.5",
"author": {
"name": "Paul Hodel",
"url": "https://www.linkedin.com/in/paulhodel"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"data-grid",
"data-spreadsheet"
],
"version": "1.5.4",
"version": "1.5.7",
"bugs": "https://github.com/paulhodel/jexcel/issues",
"homepage": "https://github.com/paulhodel/jexcel",
"docs": "https://bossanova.uk/jexcel",
Expand Down

0 comments on commit 8b94721

Please sign in to comment.