ce icon indicating copy to clipboard operation
ce copied to clipboard

Get Tittle Header

Open glenoka opened this issue 7 years ago • 6 comments

Hi, I want to get a header/tittle when I change cell. image

if I change Jazz, can I get "Car" or "Car1" I use onchange event but I get "A1".

can you help get what I want?

glenoka avatar Sep 26 '19 04:09 glenoka

This is how you do it.

<html>
<script src="https://bossanova.uk/jexcel/v3/jexcel.js"></script>
<link rel="stylesheet" href="https://bossanova.uk/jexcel/v3/jexcel.css" type="text/css" />

<script src="https://bossanova.uk/jsuites/v2/jsuites.js"></script>
<link rel="stylesheet" href="https://bossanova.uk/jsuites/v2/jsuites.css" type="text/css" />

<div id="spreadsheet"></div>

<script>
var data = [
    ['Jazz', 'Honda', '2019-02-12', '', true, '$ 2.000,00', '#777700'],
    ['Civic', 'Honda', '2018-07-11', '', true, '$ 4.000,01', '#007777'],
];

jexcel(document.getElementById('spreadsheet'), {
    data:data,
    columns: [
        { type: 'text', title:'Car', width:120 },
        { type: 'dropdown', title:'Make', width:200, source:[ "Alfa Romeo", "Audi", "Bmw" ] },
        { type: 'calendar', title:'Available', width:200 },
        { type: 'image', title:'Photo', width:120 },
        { type: 'checkbox', title:'Stock', width:80 },
        { type: 'numeric', title:'Price', width:100, mask:'$ #.##,00', decimal:',' },
        { type: 'color', width:100, render:'square', }
    ],
    onchange: function(instance, cell, x, y, value) {
        alert(instance.getHeader(x));
    }
});
</script>
</html>

pphod avatar Sep 26 '19 10:09 pphod

image

can you tell me what is wrong? I just copy and paste your code

glenoka avatar Sep 27 '19 03:09 glenoka

Sorry, my mistake.

Please change: instance.getHeader(x) to instance.jexcel.getHeader(x)

pphod avatar Sep 27 '19 10:09 pphod

How can I get the real title; Car=A Make=B

sxmny123 avatar Oct 05 '19 06:10 sxmny123

instance.jexcel.getHeader(x) you can get Car, Make, Etc.

pphod avatar Oct 05 '19 09:10 pphod

Thank you. I found an internal way to get it

sxmny123 avatar Oct 05 '19 10:10 sxmny123