Saltar para o conteúdo principal
Versão: 20 R5 BETA

VP SET TABLE COLUMN ATTRIBUTES

História
ReleaseMudanças
18 R6Adicionado

VP SET TABLE COLUMN ATTRIBUTES ( vpAreaName : Text ; tableName : Text ; column : Integer ; attributes : Object {; sheet : Integer } )

ParâmetroTipoDescrição
vpAreaNameText->Nome de objeto formulário área 4D View Pro
tableNameText->Nome da tabela
columnInteger->Índice da coluna na tabela
attributesObject->Attribute(s) to apply to the column
sheetInteger->Índice da folha (folha atual se omitida)

Descrição

The VP SET TABLE COLUMN ATTRIBUTES command applies the defined attributes to the column in the tableName.

Em vpAreaName, passe o nome da área 4D View Pro.

In the attributes parameter, pass an object that contains the properties to set:

PropriedadeTipoDescrição
dataFieldtextNome da propriedade da coluna da tabela no contexto de dados.
nametextNome da coluna da tabela. Deve ser único na tabela. If this name already used by another column, it is not applied and a default name is automaticaly used.
formulatextDefine a fórmula para cada célula da coluna. See Structured Reference Formulas in the SpreadJS documentation
footerTexttextValor do rodapé da coluna.
footerFormulatextFórmula do rodapé da coluna.
filterButtonVisiblebooleanSets whether the table column's filter button is displayed (default is True when the table is created).

In sheet, pass the index of the target sheet. Se nenhum indice for especcificado ou se passar -1, o comando se aplica a folha atual.

A indexação começa em 0.

If tableName is not found or if column is higher than the number of columns, the command does nothing.

Exemplo

Você cria uma tabela com um contexto de dados:

var $context;$options : Object

$context:=New object()
$context.col:=New collection()
$context.col.push(New object("name"; "Smith"; "firstname"; "John"; "salary"; 10000))
$context.col.push(New object("name"; "Wesson"; "firstname"; "Jim"; "salary"; 50000))
$context.col.push(New object("name"; "Gross"; "firstname"; "Maria"; "salary"; 10500))
VP SET DATA CONTEXT("ViewProArea"; $context)

//Define the columns for the table
$options:=New object()
$options.tableColumns:=New collection()
$options.tableColumns.push(New object("name"; "Last Name"; "dataField"; "name"))
$options.tableColumns.push(New object("name"; "Salary"; "dataField"; "salary"))

VP CREATE TABLE(VP Cells("ViewProArea"; 1; 1; 2; 3); "PeopleTable"; "col"; $options)

Then you want to insert a column with data from the data context and hide some filter buttons:

    //insert a column
VP INSERT TABLE COLUMNS("ViewProArea"; "PeopleTable"; 1; 1)

var $param : Object
$param:=New object()
// Bind the column to the firstname field from the datacontext
$param.dataField:="firstname"
// Change the default name of the column to "First name"
// and hide the filter button
$param.name:="First Name"
$param.filterButtonVisible:=False

VP SET TABLE COLUMN ATTRIBUTES("ViewProArea"; "PeopleTable"; 1; $param)

// Hide the filter button of the first column
VP SET TABLE COLUMN ATTRIBUTES("ViewProArea"; "PeopleTable"; 0; \
New object("filterButtonVisible"; False))

Veja também

VP CREATE TABLE
VP Find table
VP Get table column attributes
VP RESIZE TABLE