jspreadsheet / jspreadsheet/ce
User can set a non-topleft cells' value of a merged area, and the value retains after the merging is removed.
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 7.2k
- Forks
- 890
- PR merge metrics
- No merged PRs in 30d
Description
version
v4.7.3
expectation
If a cell's merged, it shouldn't have any value, unless it is the top left cell of the merged area (let's call it as "master cell"), in which case it represent the merged cell's value, or it can have value, but that should be equals to the "master cell". Anyhow, after I remove the merging, it should become blank, as the UI actually shows.
reproduce code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Document</title>
</head>
<body>
<script src="lib/jexcel.js"></script>
<script src="lib/jsuites.js"></script>
<link rel="stylesheet" href="lib/jsuites.css" type="text/css" />
<link rel="stylesheet" href="lib/jexcel.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"],
];
const a = jspreadsheet(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" },
]
});
/* End of initializtion */
a.setMerge('A1', 2, 2);
a.setValue('A1', 1);
a.setValue('A2', 1);
let a1 = a.getValue("A1");
let a2 = a.getValue("A2");
console.log(a1, a2); // print 1 1
a.removeMerge("A1");
a1 = a.getValue("A1");
a2 = a.getValue("A2");
console.log(a1, a2); // printed 1 1
/* But cell A2 is empty as UI shows after the merge's removed */
</script>
</body>
</html>
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the example using lib/jexcel.js and the setMerge, setValue, getValue, and removeMerge APIs. Trace how values in the merged range are stored and cleared; done means the non-top-left cell returns blank after removeMerge, matching the UI.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 42/100