+
1
|
list
|
skin
|
login
|
editor
α-wwwiki
::
worksheet3
user:none
(2476 bytes)
_h1 worksheet{sup 3} _p Include the worksheet library and create the worksheet : {input {@ type="submit" value="include worksheet" onclick="°° var js = document.createElement('script'); js.src = 'plugins/worksheet.js'; document.body.appendChild( js ); this.value = 'OK, worksheet is included !'; this.disabled='disabled'; °°"}} {input {@ type="submit" value="create" onclick=" getId('ws').innerHTML = WORKSHEET.create( 8, 12 ); WORKSHEET.init(); this.disabled = 'disabled'; "}} {div {@ style="display:none;"} {define LC (j i) return WORKSHEET.LCval(j,i);} } {div {@ id="ws"}} _h4 using the worksheet _p Click on "init worksheet" then select a cell and enter texts, numbers, math expressions or relations between cells in the input field. _ul {b texts and numbers} are enterered "as it is", centered in the cell. Things still to be done : when an input is recognized as "Not a Number" then it is be considered as text and aligned to the left, else it is aligned to the right with a predefined number of decimal digits ... _ul {b math expressions} must follow the lambdatalk syntax (see page [[calc]]). Examples : {pre °° {* 1 2 3 4 5 6} will display 720 {+ {* 3 3} {* 4 4}} will display 25 {sqrt {+ {* 3 3} {* 4 4}}} will display 5 if the function "sqrt" has been defined previously : {define sqrt (x) return Math.sqrt(x); } °°} _ul {b relations between cells} are recognized and updated when values change. Writing in a cell the expression {b °°{LC row col}°°} displays the value of the cell "L[row]C[col]". Examples : {pre °° if L[1]C[1] contains 123 L[2]C[1] contains ={LC 1 1} then L[2]C[1] displays 123 and will change as 123 changes if L[1]C[1] contains 123 L[2]C[1] contains 456 L[3]C[1] contains ={+ {LC 1 1} {LC 2 1}} then L[3]C[1] displays 579 °°} _ul {b but} the way the worksheet is updated needs to be improved : {pre °° if L[1]C[1] contains 123 L[2]C[2] contains ={LC 1 1} L[3]C[3] contains ={+ {LC 1 1} {LC 2 2}} then L[3]C[3] displays NaN (Not a Number) because {LC 1 1} is not evaluated when {LC 2 2} is called °°} _p So, some more work to do. I need help :) _h4 examples {show {@ src="data/worksheet_3.jpg" height="220" width="500" title=""}} {show {@ src="data/worksheet_4.jpg" height="220" width="500" title=""}} _h4 code _p The worksheet's code is visible in [[worksheet.js|plugins/worksheet.js]].