Keep updated

Documentation

Examples

Setting a readonly column or a just single cell.


Source code

<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.5.7/js/jquery.jexcel.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jexcel/1.5.7/css/jquery.jexcel.min.css" type="text/css" />

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

<script>
data = [
    ['Mazda', 2001, 2000, '2006-01-01'],
    ['Pegeout', 2010, 5000, '2005-01-01'],
    ['Honda Fit', 2009, 3000, '2004-01-01'],
    ['Honda CRV', 2010, 6000, '2003-01-01'],
];

$('#my').jexcel({
    data:data,
    colHeaders: ['Description','Year','Price', 'Buy'],
    colWidths: [ 200, 300, 100, 100 ],
    columns: [
        { type: 'text', readOnly:true },
        { type: 'text', },
        { type: 'text', },
        { type: 'checkbox' },
    ]
});

//Set readonly a specific column
$('#my').jexcel('updateSettings', {
    cells: function (cell, col, row) {
        // If the column is number 4 or 5
        if (row == 2 && col == 2) {
            $(cell).addClass('readonly');
        }
    }
});
</script>
</html>

Online demo on jsFiddle