tc_table
Read and edit table or tree rows, manage row selection, and expand or collapse nodes by choosing an action such as get_cell_text, goto_row, or select_row.
Instructions
Read and edit table or tree rows, manage selection and expand or collapse nodes. Choose action.
Common operations for objects of this type live elsewhere: tc_field(action="is_visible"), tc_field(action="is_enabled"), tc_field(action="get_context_menu"), tc_app(action="get_parent").
In the signatures below a trailing * marks a REQUIRED parameter — the group schema itself accepts every parameter as optional.
ok: true means the client accepted the command, not that anything changed — confirm an effect by reading the state back; target_check: present is not proof of one either. Where the address can be checked the response carries target_check: present, unknown (not checkable here) or off (checking disabled). target_hidden: true appears ONLY when the target exists and was NOT visible; it does NOT prove the absence of an effect — for tc_field(action="activate") invisibility is the normal precondition — it describes the ELEMENT itself and not an invisible container around it, and its absence says nothing. A wrong address is refused with an error only where the address can be checked: a read without a target marker cannot tell one from an empty answer, and tc_table(action="get_cell_text") on a table that does not exist returns text=null exactly as for an empty cell.
Actions:
can_be_expanded(ref*, row_column=null, row_value=null) Whether a table row/group can be expanded. Pass row_column+row_value to target a specific row by a column name or title; omit them to use the current row. can_expand=true does not promise that tc_table(action="expand") will work: rows reporting true have been observed to stay collapsed. The reliable evidence is tc_table(action="expand")'s own value_before/value_after pair.
change_row(ref*) Start editing the current table row/column. Needs an existing row not already in edit mode.
choose_row(ref*) Choose (select / double-click) the current table row. In a choice form this picks the row and closes the form; in a list form the same action OPENS the row's item — on a hierarchical list, the folder own card rather than stepping into the folder.
changedreports whether the ACTIVE WINDOW changed: true means a window opened or closed, which is what a completed choice looks like; false means the window stayed — the choice did not go through, or the row was picked without closing anything, so read the field you were filling to tell those apart.collapse(ref*, row_column=null, row_value=null) Collapse a form group (Group[...]) or a table node. For a table, pass row_column+row_value to target a row by a column name or title; omit them for the current row. Nothing to collapse is not an error: ok only reports that the client accepted the command. changed is false only when value_before and value_after were both read and came back equal, which happens for a TABLE node, and null when they could not be read — a FORM GROUP (the platform's Expanded applies to tables only), a failed read, or readback='off'. can_be_expanded checks a table row, not a form group, and its true is not a promise: judge by value_before/value_after.
copy_row(ref*, confirm=null) Copy the current table row. On catalog/document lists a confirmation dialog may appear — set confirm=True/False to auto-answer it (default None: no dialog handling). (1C 8.3.25+)
delete_row(ref*, confirm=null) Delete the current table row. On catalog/document lists a 'delete?' dialog may appear — set confirm=True/False to auto-answer it (default None: no dialog handling). (1C 8.3.3+)
deselect_all_rows(ref*) Clear the table's row selection. Needs platform 8.5.1 or newer — on every earlier one the platform has no such method. Plain row navigation drops the selection down to the current row, which is the only way to undo a multi-row selection there. (1C 8.5.1+)
deselect_row(ref*) Remove the current table row from the selection. Needs platform 8.5.1 or newer — on every earlier one the platform has no such method. The closest thing there is to pass over the row with toggle_selection set: that toggles it, so a selected row becomes unselected. (1C 8.5.1+)
end_edit_row(ref*, cancel=False) Finish editing the current table row. Set cancel to discard the edits instead of committing them.
expand(ref*, row_column=null, row_value=null, subordinates=False) Expand a form group (Group[...]) or a table node. For a table, pass row_column+row_value to target a row by a column name or title; omit them for the current row. Set subordinates to also expand the child rows. Nothing to expand is not an error: ok only reports that the client accepted the command. changed is false only when value_before and value_after were both read and came back equal, which happens for a TABLE node, and null when they could not be read — a FORM GROUP (the platform's Expanded applies to tables only), a failed read, or readback='off'. can_be_expanded checks a table row, not a form group, and its true is not a promise: judge by value_before/value_after.
get_cell_text(ref*, column*) Read a cell in the current row. Text may include search-highlight markup. column is the column element NAME, or its 0-based index as a number or a string of digits ('0' is index 0, not a name — an element name cannot start with a digit). Unknown or ambiguous column names are refused; a matching title suggests the element name. Only displayed columns can be read. null does not establish that the cell is empty. A column inside a COLUMN GROUP that the table shows as one column may answer with the GROUP's text — a neighbouring column's value — and that answer cannot be told from a correct one; members of other kinds in the same group answer null instead.
get_current_item(ref*) Get the current item of a table → {ref}. ref: the table.
get_current_row(ref*) Get the current table row as [{column: value}]. Returns [] if there is no current row or its values could not be read. Needs platform 8.5.1 or newer — on every earlier one, use get_selected_rows after moving to the desired row, or get_cell_text to read one column. (1C 8.5.1+)
get_selected_rows(ref*) Get the selected table rows as a list of {column: value} maps, one per selected row, in LIST order — the current row is NOT put first, so do not read rows[0] as "the first row of the list". The keys are column TITLES; the column titled "Вид" can be EditField[ЮрФизЛицо], so match by title, not by name. Which columns a row carries is decided by the platform: a column missing from the answer does not mean the row has no value there, and an empty string is ambiguous — it can be a value the platform sent as empty or a filler for a column it did not send. Values may include search-highlight markup. (1C 8.3.6+)
go_one_level_down(ref*, row_column=null, row_value=null, column=null) Go one level down in a table tree. Pass row_column+row_value to target a specific row by a column value; row_column accepts a column name or title. Omit both to use the current row. Optional column names a column to read before and after the move; changed compares its cell text.
go_one_level_up(ref*, row_column=null, row_value=null, column=null) Go one level up in a table tree. Pass row_column+row_value to target a specific row by a column value; row_column accepts a column name or title. Omit both to use the current row. Optional column names a column to read before and after the move; changed compares its cell text.
goto_first_row(ref*, toggle_selection=False, column=null) Move to the first row of a table. Set toggle_selection to also toggle that row's selection. Pass column (the column element NAME) to have that cell read before and after the move: it comes back as value_before/value_after with changed=true when they differ. changed=false only means the two texts are the same — different rows can share a value; without column nothing is read and changed is null.
goto_last_row(ref*, toggle_selection=False, column=null) Move to the last row of a table. Set toggle_selection to also toggle that row's selection. Pass column (the column element NAME) to have that cell read before and after the move: it comes back as value_before/value_after with changed=true when they differ. changed=false only means the two texts are the same — different rows can share a value; without column nothing is read and changed is null.
goto_next_item(ref*) Move to the next item within a table. ref: the table.
goto_next_row(ref*, toggle_selection=False, column=null) Move to the next row of a table. Set toggle_selection to also toggle that row's selection. Pass column (the column element NAME) to have that cell read before and after the move: it comes back as value_before/value_after with changed=true when they differ. changed=false only means the two texts are the same — different rows can share a value; without column nothing is read and changed is null.
goto_previous_item(ref*) Move to the previous item within a table. ref: the table.
goto_previous_row(ref*, toggle_selection=False, column=null) Move to the previous row of a table. Set toggle_selection to also toggle that row's selection. Pass column (the column element NAME) to have that cell read before and after the move: it comes back as value_before/value_after with changed=true when they differ. changed=false only means the two texts are the same — different rows can share a value; without column nothing is read and changed is null.
goto_row(ref*, column=null, value=null, direction='down', toggle_selection=False, fields=null) Go to the table row where column equals value (int or string; the wildcards * and ? work). column is the column TITLE; an index is not accepted here. Pass fields ({column: value}) to match several columns at once. Seeks directly, so there is no need to walk rows. Matching is CASE-SENSITIVE and compares the value as SHOWN ("Встреча агента (Совещание)"), so a wildcard is often what you want. The search starts at the CURRENT row, runs in direction (down by default, or up) to the end of the list and does NOT wrap; the current row is itself a candidate, so searching for the value the cursor already sits on reports found=true without moving — step off the row first to find the NEXT match. A search that finds nothing still MOVES the cursor, to the last row going down, the first going up. Set toggle_selection to toggle the row it lands on; with no column and no fields it just toggles the current row. found is null when there was nothing to search for or the search result could not be determined — null never means "not found". In the answer
criteriarepeats the TITLE you searched by andobserved.columngives that same column NAME. (1C 8.3.2+)is_expanded(ref*, row_column=null, row_value=null) Whether a table row is expanded. Without row_column this reads the CURRENT row. Pass row_column (column name or title) and row_value to read another row without moving the cursor.
select_all_rows(ref*) Select all rows of a table. (1C 8.3.6+)
select_row(ref*) Add the current table row to the selection. Needs platform 8.5.1 or newer — on every earlier one the platform has no such method. Build a selection there by moving through rows with toggle_selection set — each row the cursor passes is toggled. (1C 8.5.1+)
set_cell_text(ref*, column*, text*) Set text in the current row's column (element name). Handles focus and row editing, then reads the result. Empty text clears the cell. Returns verified, changed and value_before/value_after. Numeric formatting can return verified=null with verification=numeric_equivalent. Continues an existing row edit, including a newly added row, and finishes it without discarding other cells' edits.
set_order(ref*, column*) Sort a table by a column, addressed by its TITLE. There is no direction parameter and no way to read the current direction: calling it again on the same column reverses the order. To learn which way it went, go to the first row and read a cell. (1C 8.3.6+)
switch_row_delete_mark(ref*, confirm=True) Toggle the deletion mark of the current row. Raises a modal 'mark for deletion?' dialog that is auto-answered: confirm=True → Yes (default), False → No. dialog_answered only reports that a modal question was answered — it is NOT evidence that the mark changed, and changed is always null here because the platform exposes no readable deletion-mark flag. To check the result, click the row's mark command and read the question text: 'mark for deletion?' means it is not marked, 'remove the mark?' means it is. (1C 8.3.6+)
table_add_row(ref*) Add a row to a form table. Fill its cells with set_cell_text using column element names. connection_id selects the client. Passing ref selects the client automatically; otherwise, with several clients, connection_id is required. Use tc_session(action="list_connections"). Pass reference values returned by the tools unchanged in ref. If a reference expires, find the element again.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ref | No | ||
| text | No | ||
| value | No | ||
| action | Yes | ||
| cancel | No | ||
| column | No | ||
| fields | No | ||
| confirm | No | ||
| direction | No | ||
| row_value | No | ||
| row_column | No | ||
| subordinates | No | ||
| connection_id | No | ||
| toggle_selection | No |