JsTable v0.4.5
Author: AT Mulyana
25 Juli 2005
Table of Contents
JsTable is a DHTML widget of table that can be inserted into a web page
via JavaScript. The table has the following three main features or
purposes:
- Editable, the cell's
content in table can be edited. Each column can have the special type
of data (string, number, date or boolean). Depending on its type, the
editor for cell can vary, for example string, number and date
column will show textbox for editing, and boolen column will show
checkbox.
- Navigatable, because of
the first feature, it does not make sense if the table is not
navigatable which means that the active cell can be changed into
another cell by pressing arrow key on keyboard or by clicking mouse on
another cell. The active cell is the cell in which we can edit its
content. When the cell is edited, we cannot move the active cell into
another one. The editing state must be ended first, if wanting to move
the active cell.
- Submittable, its very
special feature. Submittable means the table's content can be submitted
to the web server via usual web HTTP protocol. You can understand
easily that the table contains elements of FORM. Why must be
submittable? Cause most cases, we want the user submits what he/she
filled in table. For example, the user fills purchased goods list that
contains goods code, quantity etc. The kind of that list is usually
visualized by a table, one column contains goods code, another one
contains quantity etc. Each row, of course, represents different goods.
Formerly, I was tempted to include the paging to be the one of the
features. But then, I realized that the purpose of this table is for an
input, not for a report. You should find easily the kind of that table
out there.
Here is the supported browsers by JsTable. Actually, it's the best
version I have but I choose them as the minimum version for JsTable.
Even if it's the minimum version, it's not guaranteed that the
later version will still be good (I found some lack). I hope you
get the best browser so that you can run JsTable correctly. The target
browsers are:
- Netscape 7.1+ / Mozilla 1.4+ or other Gecko browsers whose the
same or the newer version of Gecko Engine.
- Internet Explorer 6+
- Opera 7.5+
I have found a client that gave me a complaint because he cannot work
fast to fill a goods list when he had to finish a lot of transaction in
rush. The user interface on web application we provide (and I guess on
most web application) is too ugly for this condition. The user wants
easily to move from one cell to another, only by pressing keyboard,
such as arrow key or enter. The key Tab can be used but with some lack
of free movement. So, I create this DHTML widget to enhance web
application. There are some reasons to still maintain web application
(you know if you like web application).
To design this DHTML widget, I consult table widget in Java Swing named
JTable (Therefore, I name this widget with JsTable). But I
don't make JsTable become exactly the same as JTable, you know it's
very hard, JTable is too complex for my purposes and also the
simplicity is still needed for web widget. But some mechanisms in
JTable still give me the idea.
TableModel
here is not the same as one in Java Swing JTabel. After defined for a
JsTabel, it cannot be redefined for that JsTabel. TabelModel here is
only to collect some properties for JsTabel and also a method to
control editability of the cells on JsTabel. To create
TableModel, use statement:
var
oTableModel = new
JsTableModel(columns,phpStyle,numberDenominator,dateFormat,oldValIfInvalid,withPrimaryKey);
Parameters:
columns
is an array of column type. Next section will show how to define column
type. The first item (index 0) in array is column type for column 0,
the second is column type for column 1 and so on.
phpStyle
is boolean to determine whether the server script is PHP or not. In
PHP, to create HTTP POST/GET parameter as an array, we must provide
bracketed brace ( [] ) after the name of FORM element that will become
an item
of the array, beside each of those elements must have the same name. As
far as I know, this behaviour is only in PHP.
numberDenominator
is the character that will be used to seperate thousands denomination
for the value in number column. The valid character is ',' (comma) or
'.' (period). The default is period. If the chosen denominator is
period then the decimal point is comma and vice versa.
dateFormat
is string to detemine the date format. The valid values are 'd-m-y'
(format: dd-mm-yyyy) or 'm-d-y' (format: mm-dd-yyyy). The default is
'd-m-y'. This format is used by column whose type of date or date time.
The value typed by user on these columns must conform the defined
format here.
oldValIfInvalid
is boolean to determine whether the old value must be rollbacked when
the user type the invalid value. The default for this parameter is
false, that is
if the invalid
value appears then this value will be considered as the default value
depending on its column type.
withPrimaryKey
is boolean to determine whether the primary key (uses database term)
will be given when insert a row into table. The default is
false, that is
the primary key
will not be given but use the row index in table to replace this
primary key. Primary key is needed by column whose type of boolean
(whose editor is check box). The primary key will become the value of
checkbox that will be sent to the web server.
Properties:
The properties are set after TableModel is created.
- enterAfterEdit
is integer
to determine behaviour after editing. After editing a cell and then, if
pressing Enter to end the editing, we
can set whether the active cell will move to the right, down or not
move. The possible values for this property are JsTable.ENTER_STAY,
JsTable.ENTER_MOVE_DOWN
and JsTable.ENTER_MOVE_RIGHT.
TableModel has a method to control the editability of the cells, named
isCellEditable.
This method
takes two parameters, the first is the row index (starting from 1, the
index 0 is column's header) and the second is the column index
(starting from 0). With these two paramters, we can control the
editability for a specific cell. If for the combination of a row index
and a col index, the method returns
false then the
cell whose index
with that combination will not be editable. By default, this method
always returns
true
(all
cells are editable). Below is the examples.
- If the cell whose row index is 1 and column index is 0 cannot be
edited then define the method like:
oTableModel.isCellEditable = function(iRow,iCol) {
if (iRow == 1 &&
iCol == 0) return false;
return true;
}
- If all cells on the first row cannot be edited then define the
method like:
oTableModel.isCellEditable = function(iRow,iCol) {
if (iRow == 1) return
false;
return true;
}
- If all cells on the first column cannot be edited then define the
method like:
oTableModel.isCellEditable = function(iRow,iCol) {
if (iCol == 0) return
false;
return true;
}
You may search more conditions to determine the cell is editable or
not, not only check the row index or column index directly.
Each column in table has the specific type of data for value contained
in all cells on that column. If the user types the invalid value then
the value will be altered to default value of data type of that column
or, as defined in TableModel, the old value will be rollbacked. The
examples of default value are 0 for number type, the first option for
options type, '00-00-0000' for date type etc. Each column type will
have the appropriate cell editor to edit the cell's content. Each
column type is
defined when creating TableModel as described in previous section. To
announce the column type, we must create an object of a column type
class. Then this object become the item of the array that become the
first parameter for creating TableModel. The following list is the
classes of column type that are currently provided by JsTable. Each
class declares some parameters that will become the properties of the
created object. The parameters of each class is varied but the first
four parameters must be
columnName,
inputName,
width and
align.
The meaning of each
parameters are:
columnName
is header/title of column that will be displayed on the top row in
table.
inputName
is the name of form element representing each cell that will be sent to
web server. Mostly, this form element is an
<INPUT
type=hidden>. This
form element exists inside each cell and its value always represents
the cell's content. For column type of boolean, the form element is
<INPUT
type=checkbox>.
The value of
columnName
will become the value of attribute
name of
those form
elements. For column type of link, the value of
columnName
will become the
value of attribute
name
of link. This rule has consequences that each column will send an array
to web server (if submitted) that each item in array representing each
value in the cells on the column. Note, if
phpStyle is
set to
true
in TableModel, each form
element's name will be appended with '[]' to construct an array. For
other server scripts, it may not construct an array if the table only
has one row.
width
is initial width for the column. It's integer.
align
is the text alignment inside cell. The valid value is 'left', 'right'
or 'center'.
Here, the available column class:
- JsTableColumnString(columnName,inputName,width,align)
It is for column that will store the string value. The string value is
seemly no restriction.
Cell Editor : textbox
(element TEXTAREA
or <INPUT
type=text>)
- JsTableColumnNumber(columnName,inputName,width,align,denomination,fracDigits)
It is for column that will store the number value. On this column, the
user is only allowed to type the characters which is considered to be
going to construct the valid value for a number. The allowed characters
are number
(0 - 9), hyphen (-) for minus sign and decimal point character
depending on the setting in TableModel (comma or period). Other than
those
characters, the character will not be displayed. Even though there is a
checking when typing, the validity of value is still checked when the
user ends the editing.
Beside the four general parameters, there are two additional
parameters, those are:
- denomination,
if true
then the
thousands denomination in number will be separated by comma or period
depending on the setting in TableModel.
- fracDigits
is
the number of digits after decimal point. If the given value has the
number of digits after decimal point is more than fracDigits
then the value is
rounded until there are fracDigits
digits after decimal point. If less than fracDigits
then 0 will appended
appropriately.
Cell Editor : textbox
(element TEXTAREA
or <INPUT
type=text>)
- JsTableColumnBoolean(columnName,inputName,width,align)
It is for column that will store the boolean value. Each cell will have
checkbox that represents the cell's value. Note, the value of the
checkbox will be sent to web server when submitted. As we know, only
checkbox checked will send its value. So, it's the task of your server
script to investigate which row has value true (the
checkbox is checked)
and which row has value false.
Cell Editor : checkbox
(element <INPUT
type=checkbox>)
- JsTableColumnOptions(columnName,inputName,width,align,options)
It is for the column that gives some options of possible values allowed
to be filled into the cell on the column. The parameter options is an
array containing
the possible values. Each item of this array is object of class JsTableOptionValues(arValuesSent,arValuesShown).
The first parameter, arValuesSent,
is an array of the option value that will be sent to web server. The
second paramater is an array of value that will displayed in the cell.
If the second parameter is not defined then it will be the same the
first one. If defined, both array should have the same length.
Cell Editor : combobox
(element <SELECT>)
- JsTableColumnDate(columnName,inputName,width,align,saveAsSQLformat)
It is for the column that will store the date value. The available date
format is 'dd-mm-yyyy' and 'mm-dd-yyyy'. Date format is specified when
creating TableModel. The allowed characters to be typed by user are
number (0 - 9) and hyphen (-). The user may type one digit for day and
month but must four digits for year. After editing, the value will
recheked for its validity, especially for the range of day value and
month value. The additional parameter saveAsSQLformat
is to specify
whether the date value will be sent to web server with SQL format, that
is 'yyyy-mm-dd'. The default is false
(the value will be sent 'as is').
Cell Editor : textbox
(element TEXTAREA
or <INPUT
type=text>)
- JsTableColumnDateTime(columnName,inputName,width,align,saveAsSQLformat)
The same as the date column except it has the time part. The time part
is formatted by 'hh:nn:ss' and separated by space from date part. Time
part appears after date part. Beside number and hyphen, the other
allowed characters are space and colon (:). The user may type only one
digit for each element in the time part.
- JsTableColumnLink(columnName,inputName,width,align,identifier,href)
It's the special column type. The cells will contain a link (element <A> with
attribute href
is set). They may refer to
another page or execute the javascript statements. I suppose that
mostly, it will execute the javascript statement. There are two
additional parameters:
- identifier
is
something to be displayed as a link. It can be the text (string value)
or DOM Node object. DOM Node object is intended to be an image elment
object (element <IMG>).
- href
is the
value of attribute href
of the link. The value of this parameter can contain '__PRIMARY_KEY__'
that will be
replaced by the primary key of each row and can contain '__ROW__' that
wiil be replaced
by the index of each row.
One more interesting column class is radio button (element
<INPUT
type=radio>). But
because each row must have different name for its radios (each row has
one group of radios and thus the radios have the same name, but
different row must have different name because different group), not
convenient to construct an array for one column that will
be sent to web server as HTTP POST/GET parameter. The radio column
class can be substituted by options column class (
JsTableColumnOptions).
Example:
var columns = [
new JsTableColumnString('String','string',120),
new JsTableColumnNumber('Number','number',75),
new JsTableColumnNumber('Denominated
Number','denNumber',75,'right',true,2),
new JsTableColumnBoolean('Boolean','boolean',50),
new JsTableColumnOptions(
'Options','options',100,align,
new
JsTableOptionValues(['Satu','Dua','Tiga'],['_Satu','_Dua','_Tiga']) ),
new
JsTableColumnDate('Date','date',70,'center',true),
new
JsTableColumnLink('','link',50,'center','Edit',
'javascript:editRow(__PRIMARY_KEY__)')
];
var
oTableModel =
new JsTableModel(columns,true);
To create JsTable, use the statement:
oJsTable = new
JsTable(sId,oTableModel,oParent,oNextSibling);
Now,
oJsTable
is holding
the reference of an instance object of JsTable. Note,
oJsTable
doesn't refer to
object of HTML Table element on which we will do editing but it holds
the reference object that controls the table object.
Parameters:
- sId
is the id of
table. It must be the unique id and a qualified variable name. If not
so, an error will occur. When JsTable is created, the global variable
named with sId
will be
created. This variable holds the reference to appropriate HTML Table
object. The second global variable also will be created, named with '_'+sId
(prefixed by
underscore). This variable holds the same reference held by oJsTable.
- oTableModel
is
TableModel object as described in previous section.
- oParent
is the
object of parent element in which the table will be inserted. If you
want the content of table can be submitted to web server, this object
must be the HTML form object or the HTML element object inside the form
object.
- oNextSibling
is the
HTML element object before which the table will be inseted. It may be null, the
table will be
inserted as the last child.
Example:
var
oTableModel = new JsTableModel(columns,true,'.','d-m-y',true);
var oJsTable =
new JsTable('goodsList', oTableModel, document.forms[0],
document.forms[0].elements['submit']);
Methods:
- setHeader(sHeader,
iCol)
Not yet tested.
Set the column header.
Parameters:
- sHeader
is the
new header of column
- iCol
is the
index of column
- setValue(val,
iRow, iCol)
Set the new
value in a cell.
Parameters:
- val
is the new
value. It's the true value that can be evaluted by javascript as the
data type depending on the column type. If the column type is number
then val
is the data of
number type or string that can be evaluated to number. If value of val is invalid
then JsTable
will try to convert to the valid value or the value will replaced by
the default value depending on the column type.
- iRow
is the row
index of the cell, starting from 1. If the value of iRow is out of
range, the
method will halt.
- iCol
is the
column index of the cell, starting from 0. If the value of iCol is out of
range, the
method will halt.
- getValue(iRow,
iCol)
Not yet tested. To
get the value inside a cell. This value is the true type of data
depending on the column type. For column number, the returned value is
the data of number type (without denomination).
Parameters:
- iRow
is the row
index of the cell.
- iCol
is the row
index of the cell.
- insertRow(args,primaryKey,iRow)
Insert the new row into the table.
Parameters:
- args
is an array
of the values for the cells on the new row. You may supply the empty
array for this parameter, if so then the value of each cell will be set
to the default value.
- primaryKey
is
the primary key for the row. This parameter has the meaning if withPrimaryKey
in TableModel is
set to true.
- iRow
is the row
index for the new row, in other words, the new row will be
inserted before the row whose index iRow.
If this parameter is not defined or its value is out of range then the
new row will appended become the last row. For Netscape/Mozilla, you
should ignore this parameter, see secton known bugs.
- addMatrix(args2,primaryKeys)
Not yet tested. To add some
row into table. The new rows will appended after the last row. This
method will invoke method insertRow
repeatedly.
Parameters:
- args2 is the two dimentional array of the values of each cell
on each row.
- primaryKeys
is
an array of the primary keys for each row. This parameter has the
meaning if withPrimaryKey
in TableModel is
set to true.
- deleteRow(iRow)
Deletes a row. For the cells which holds the row index
(checkbox and Link), the row index held by them will be reordered.
Parameter:
- iRow
is the row
index of the will be deleted row. If its value is out of range, the
method will do nothing.
- insertKey(sKeyName,val,iRow)
Not yet tested.
Inserts/updates a key into some row. The key may be useful for
processing on the server but the value of key does not have meaning if
displayed
on the web page. Technically, this key will be held by the element <INPUT
type=hidden> and
this element will be stored in the first cell of the corresponding row.
Even if this method insert the key into some rows but all rows will be
checked whether that row already has that key. If not, the key will be
created and its value will be set to empty string.
Parameters:
- sKeyName
is the
name of the key.
- val
is the value
of the key. It can be an array, if so, the key will be set on the rows
starting iRow
until the
length of array. If the row index has reached the last row but there
are still some items in array, the remainder items will be ignored.
- iRow
is the
starting row index for which the key will be set.
- setFocus(bGetFocus)
Gives or removes focus to/from table.
Parameter:
- bGetFocus,
if true
then the focus will be
given. Otherwise, the focus will removed.
- setActiveCell(iRow,
iCol)
Changes the active cell. If the table does not yet have focus, the
focus will be given.
Parameters:
- iRow
is the row
index of the new active cell
- iCol
is the
column index of the new active cell.
Properties:
All properties here must be treated as read only.
- row
is the row
index of the current active cell.
- col
is the column
index of the current active cell.
- hasFocus,
if true
the the table currently
has focus.
To give focus to table, click on the table. The cell on which we click,
automatically become the active cell. As said before, the active
cell is the cell in which we can edit its content. If usually its cell
editor is hidden for that cell, when the cell is active, it reveals its
cell editor, so we can edit it.
Navigation:
We can move the active cell by pressing the arrow
keys on keyboard by intuitive direction. We can also click on a cell,
if we want that cell become active.
Editing:
To edit the cell's content needs some steps which is
different for different cell editor. I will explain for each cell
editor.
- Textbox (element <TEXTAREA>
of <INPUT
type=text>, currently only element <INPUT
type=text> is used)
To edit, press Enter. Then we will go into the state, we call it editing state. In editing state,
the text cursor will appear and thus we can edit the cell's content.
When in editing state, the arrow keys cannot be used to navigate but
used
to move text cursor instead. To end the editing state, press Enter
again. Another way to go into editing state is by pressing F2 (on
Opera, F2 has the meaning for the browser itself). To end the editing
state, press Esc. Pressing any valid character will also set the
JsTable into editing state automatically (as of version 0.4.5). We can
also double
click on a cell (may be triple
click) if we want to edit the cell. But to end the editing state, still
use the keyboard. Clicking on another cell, when the active cell is
edited, will end the editing state of current active cell and move the
active cell to the cell has just been clicked.
Note, when pressing Enter to end the editing, the active cell may move
to depending on the value of property
enterAfterEdit
of TableModel.
- Checkbox (element <INPUT
type=checkbox>)
To change the state of the checkbox, press Enter or Space. Clicking on
the cell will also change the checkbox' state.
- Combobox (element <SELECT>)
To edit, press Enter and then going into editing state. Use up arrow
and down arrow, to change the option. Press enter again, to end the
editing state. Key F2 can also be used but key Esc may not be useful in
all browsers. Esc may reset the option. Another way to change the
option, when in editing state, press Alt+down_arrow, the the combobox
will reveal its option, choose option by pressing down arrow or up
arrow and then press Enter to end the editing state. This way doesn't
run perfectly in all browsers.
If you want to use mouse, do with usual steps: click on the combobox
and choose the option.
- Link
The Link cannot be edited but only execute its link's target. To
execute its target, press Enter or click the Link.
As usual term, the event handler is a function that will be executed
when an event happens. JsTable supports some event handlers. Note, it's
not event handler attached via DOM Event method, but it's only a method
of JsTable that you can redefine. These event handlers are executed
after all process for JsTable itself (you cannot cancel what JsTable
does). Here are those event handlers:
onkeydown
is invoked when key down event occurs.
onkeypress
is invoked when key press event occurs.
Your should know the difference between this event and the above one.
oncellchange
is invoked when the active cell is
changed (property row
or col
is changed).
oncommit
is especially directed to cell editor
textbox. This event occurs when the user has finished the editing.
JsTable script, when embeded to a web page, will try to insert some
stylesheet rules for the necessity of JsTable's appearance itself. This
rules can be overwritten by you to fit your taste. The style rules of
yours should be inserted after the JsTable script is inserted. Below is
the default style rules inseted by JsTable script.
.JsTable {
background-color:black; }
.JsTable TH {
background-color:white;
height:18px;
font-family:arial,sans-serif;
font-size:12px; }
.JsTable TD {
background-color:white;
height:18px;
font-family:arial,sans-serif;
font-size:12px; }
.JsTable TEXTAREA {
background-color:#cccccc;
margin:0px;
padding:0px;
font-family:arial,sans-serif;
font-size:12px; }
.JsTable INPUT {
background-color:#cccccc;
margin:0px;
padding:0px;
font-family:arial,sans-serif;
font-size:12px; }
.JsTable INPUT.checkbox {
background-color:transparent; }
.JsTable .cell-focus {
background-color:#cccccc; }
.JsTable SELECT {
background-color:#cccccc;
margin:0px;
padding:0px;
font-family:arial,sans-serif;
font-size:12px;
height:16px; }
There are some points to be explained here. All JsTable's class name is
'JsTable'. The rule for class 'JsTable' above is only to set
background. This background, actually is used to make the border of
cell. This is done by specifying attribute
cellspacing
of
JsTable is higher than 0. So, the background color of JsTable will look
like the border of cell. You should not create the rule for setting the
border of cell.
As explained before, element
TEXTAREA
,
INPUT
and
SELECT
are used for cell editor. The background color
of these element is distinguished from background color of cell. It is
to distinguish which the active cell and not. Because the background of
cell editor will be the background of active cell. There is also the
class 'cell-focus' which is used to set the background of the active
cell inside the column whose type of boolean and link. The checkbox and
link as the cell editor are not too big to show that its cell is
currently active.
Class 'checkbox' is used by checkbox. It is especially for Internet
Explorer. Explore yourself.
JsTable enhance some standard javascript objects with some additional
methods to support the process inside JsTable itself. However, once you
insert JsTable script then those additional methods will be available
for you. You may use them for your own purpose. I will explain these
methods per one object.
Object
String
:
strip
Removes preceding and trailing white space from this string and returns
the result as new string. The original string doesn't change.
isNumeric
Checks whether this string evaluates to numeric value. Returns true
if it does.
isQualifiedVarName
Is this string the qualified variable name (can be used as variable
name).
isDate(sFormat)
Checks whether this string is the valid date value depending on the
format noted by parameter sFormat
. The parameter can be
'd-m-y' for date format 'dd-mm-yyyy' or 'm-d-y' for date format
'mm-dd-yyyy'. If valid then this method will return the normalized date
value (day and month are always 2 digits). Otherwise, it returns false
.
isDateTime(sFormat)
Checks whether this string is the valid date-time value depending on
the format noted by parameter sFormat
. The value for the
parameter is the same as one for method isDate
. If valid
then this method will return the
normalized date-time value (day, month, hour, minute and second are
always 2 digits). Otherwise,
it returns false
.
giveDenomination(denominator,fracDigits)
Returns new string constructed from this string which is given
the denomination. This string must evaluate to a numeric value. If not
so,
this string will be returned whithout changes. Parameter denominator
,
can be period or comma, is the character will be used to be thousands
separator. Parameter fracDigits
is the number of digits
after decimal point.
removeDenomination(denominator,alterPointDecToPeriod,ignoreNumeric)
The inverse of method giveDenomination
. Parameter denominator
is the same as before. Parameter alterPointDecToPeriod
(true
/false
)
is to determine whether the decimal point must be altered to period
because it can be a comma. The result of this process may become non
numeric value. If this happens then the the returned value will be this
string without any change. Parameter ignoreNumeric
is to
ignore the fact that this string is not numeric.
Object
Date
:
ddmmyyyy
Returns date string formatted by 'dd-mm-yyyy'. Of course, the date
value depends on the instance object of Date
itself.
mmddyyyy
Returns date string formatted by 'mm-dd-yyyy'.
sqldate
Returns date string formatted by 'yyyy-mm-dd'.
timeStamp(format)
Returns date-time string formatted by 'dd-mm-yyyy hh:nn:ss' or
'mm-dd-yyyy hh:nn:ss' or 'yyyy-mm-dd hh:nn:ss', depending on parameter format
('d-m-y' or 'm-d-y' or 'sql').
setFrom_ddmmyyyy(ddmmyyyy)
Sets the date value from date string formatted by 'dd-mm-yyyy'. The
string become the parameter.
setFrom_mmddyyyy(mmddyyyy)
Sets the date value from date string formatted by 'mm-dd-yyyy'. The
string become the parameter.
setFrom_sqldate(sqldate)
Sets the date value from date string formatted by 'yyyy-mm-dd'. The
string become the parameter.
JsTable has been tested on
Windows 2000/XP:
- Netscape 7.1, Mozilla Firefox 1.0.1
- Opera 7.5, Opera 7.54u2, Opera 8 beta 1 (build 7401), Opera 8
beta 2 (build 7483), Opera 8 beta 3 (build 7522)
- Internet Explorer 6
Linux Mandrake 10:
- Netscape 7.1, Mozilla 1.6
- Opera 7.54u2
From testing, I found some bugs. May be, it's not bug but only naughty
behaviour. I will explain per version of browser.
- Opera 8 beta 1
- The cell whose cell editor text box, cannot be edited (fatal).
Upgrade or downgrade to other versions I write here.
- Opera 7.54u2 under Linux
- Sometimes, when clicking the combo box, will trigger the blur
event on it. Therefore, the combo box will disappear. When this problem
comes, use keyboard to edit the cell's content. Move the active cell
(when combo box appear) to another cell by keyboard, the dissease will
be lost.
- When you press a key on keyboard and hold it some while and the
realease it, usually the order of events will be: keydown - keypress -
keypress - keypress - ..... - keyup. But here the order become: keydown
- keypress - keyup - keypress - keypress - ........ May be, nothing bad
about it but some little operation depends on it.
- Mozilla / Netscape
- When using method
insertRow
, you should ignore
the parameter iRow
(index of row to which the new row
will be inserted). You should append the new row become the last. It
because when we submit the content of table, the order of row is not
the same as physically looks on browser. But the order will follow the
order of time of insertion.
- When cell's padding is set to value higher than 0 (via CSS or
attribute
cellpadding
of table), it will make the column
width of the active cell will be wider when it get focus. It looks bad.
- All browsers
- For column whose cell editor is textbox, when the input text
given by
user is too long, of course the cell will resize appropriately.
However, when the cell editor comes when the cell become active, the
dimension of the cell will be inconsistent. It's good if you want the
animation.
You may send bugs reports to
atmulyana@yahoo.com.
Tell the exact version of your browser and under which Operating System
you run the script.
There may be some enhancement features in JsTable next time. However,
the main feature I desire to implement is to read from HTML format and
then translate it become an instance object of JsTable. So, you can see
the template of JsTable. Another feature that is somewhat crucial, is
smarter editing behavior, like in Excel. This would make the user feels
more comfortable.