ข้ามไปเนื้อหา

ผลต่างระหว่างรุ่นของ "CuneiForm"

เพิ่มขึ้น 423 ไบต์ ,  15 เมษายน 2567
บรรทัดที่ 567: บรรทัดที่ 567:


=== Search and Fill ===
=== Search and Fill ===
In the search-fill function, a CuneiForm take responsibility in two areas:
# Invoking the corresponding [[CuneiTable|search table]] or [[CuneiModal|search modal]]. The control of the client-side behaviours is then relinquished to the table or modal.
# Once the table or modal has retrieved the selection result from the server, the client-side control is handed back to the CuneiForm to do the form filling.
==== Searching ====
Searching and filling sub-routine can be triggered in 3 ways listed below, with slightly different behaviours. These 3 trigger paths can be conflicting, thus the '''populating''' and '''search_filling''' flag attributes.
Searching and filling sub-routine can be triggered in 3 ways listed below, with slightly different behaviours. These 3 trigger paths can be conflicting, thus the '''populating''' and '''search_filling''' flag attributes.
# '''Click event''' on the adjacent search button [[ไฟล์:Cuneifox search btn.png|25px|frameless|alt=Search button|Search button]]. This trigger mode always launch the search modal with full selections. In this trigger path, CuneiForm commands the search modal to launch, then relinquishes control. The control is only handed back once a selection is made.
# '''Click event''' on the adjacent search button [[ไฟล์:Cuneifox search btn.png|25px|frameless|alt=Search button|Search button]]. This trigger mode always launch the search modal with full selections then cedes control.
# '''Pressing {{key press|Tab}} or {{key press|Enter}}''' to navigate away from the search field. This triggers the ''quick-search'' mode ''(see note)''.
# '''Pressing {{key press|Tab}} or {{key press|Enter}}''' to navigate away from the search field. This triggers the ''quick-search'' mode.
# '''Navigating away from the field by any other means''' (handled by ''change'' event on the field) also triggers the ''quick-search'' mode ''(see note)''.
# '''Navigating away from the field by any other means''' (handled by ''change'' event on the field) also triggers the ''quick-search'' mode.
 
CuneiForm only triggers ''quick-search'' mode for single-selection search tables; multi-selection tables are always invoked in normal mode.


In ''quick-search'' mode, CuneiForm commands the search table (directly within the search modal) to send a modified data fetch request first, then relinquishes control. The modified CuneiTable fetch request has a special instruction to:
In ''quick-search'' mode, CuneiForm commands the search table (directly within the search modal) to send a modified data fetch request first, then relinquishes control. The modified CuneiTable fetch request has a special instruction to:
* Fetch only entries whose search column value start with the field value.
* Fetch only entries whose search column value start with the field value.
* If the fetch returns multiple entries, the search modal is launched by CuneiTable itself.
* If the fetch returns multiple entries, the search modal is launched by CuneiTable itself.
* If the fetch returns only 1 entries, automatically make the selection and does not show the search modal at all. (The modal might appear if the server takes longer than 500ms to response, in that case, the modal will automatically close.)
* If the fetch returns only 1 entries, automatically make the selection and does not show the search modal at all. (The modal might appear if the server takes longer than 500ms to respond, in that case, the modal will automatically close.)


'''NOTE THAT''' trigger paths #2 and #3 only work if the field value is modified (detected via ''input'' events on the field) to prevent unnecessary requests.
'''NOTE THAT''' trigger paths #2 and #3 only work if the field value is modified (detected via ''input'' events on the field) to prevent unnecessary requests.
==== Filling ====


=== Instacalc Routine ===
=== Instacalc Routine ===