ผลต่างระหว่างรุ่นของ "CuneiTable"
ไม่มีความย่อการแก้ไข |
(→Define) |
||
บรรทัดที่ 27: | บรรทัดที่ 27: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
''The subclass '''SubForm''' is defined like the stripped down version of [[CuneiForm]]. Only put fields and validation logics here. All other behaviours are controlled by the ''' | ''The subclass '''SubForm''' is defined like the stripped down version of [[CuneiForm]]. Only put fields and validation logics here. All other behaviours are controlled by the MASTER variables from the CuneiTable level.'' | ||
=== The Holy Trinity of CuneiTable === | |||
=== Table with a Separate Form Modal === | |||
''Making a table with fullform?'' You can stop this section here. | |||
=== In-line Form with Expansion === | |||
=== Choices and Radios === | |||
=== Search and Fill === | |||
=== Instant Calculation === | |||
=== Auto-numbering Function === | |||
=== Other Table Definition Variables === | |||
== Initiate == | == Initiate == |
รุ่นแก้ไขเมื่อ 16:24, 16 เมษายน 2567
CuneiTable is designed specifically to enable in-line data entry. Design-wise, it is more limited than CuneiForm since design flexibility is not highly expected from table-rype objects. In essence, CuneiTable is a wrapper for the accompanying CuneiForm, whether that form be the in-line type or the full expansion type.
Define
Defining a CuneiTable is essentially declaring a CuneiForm with a few additional class variables. Below is an example of a very basic CuneiTable:
class AccCodeTable(CuneiTable):
MASTER_colsizes = [10, 20, 50, 20]
MASTER_colnames = ["StID", "Account Code", "Account Name", "Account Group"]
MASTER_coltypes = ["int", "str", "str", "sel"]
MASTER_choicecols = ["accgrp"]
MASTER_choices = [[
("1", "1: Asset"),
("2", "2: Liability"),
("3", "3: Equity"),
("4", "4: Revenue"),
("5", "5: Expense")
]]
MASTER_firstonly = ["stid"]
class SubForm(FlaskForm, CuneiSubForm):
stid = StringField("StID")
code = StringField("Code", validators=[InputRequired("Required!")])
name = StringField("Name", validators=[InputRequired("Required!")])
accgrp = SelectField("Group", default=1)
def validate_stid(self, stid):
# Validation goes here
The subclass SubForm is defined like the stripped down version of CuneiForm. Only put fields and validation logics here. All other behaviours are controlled by the MASTER variables from the CuneiTable level.
The Holy Trinity of CuneiTable
Table with a Separate Form Modal
Making a table with fullform? You can stop this section here.