B-Arts DocumentationIndice generale

BEditor - esempi

Campi applicativi

<BEditor @ref="editor"
         Fields="campi"
         GetValueField="RisolviCampo"
         ShowGroupFields="true"
         ShowFieldsPanel="true"
         @bind-Text="templateHtml" />
private readonly List<BItem> campi =
[
  new("Cliente.Nome", "Nome cliente"),
  new("Documento.Numero", "Numero documento")
];

private Task<string> RisolviCampo(string key)
{
  string value = key switch
  {
    "Cliente.Nome" => cliente.Nome,
    "Documento.Numero" => documento.Numero,
    _ => ""
  };

  return Task.FromResult(value);
}

Per ottenere il risultato usare await editor.GetHtmlAsync(); non leggere o riscrivere il DOM tramite JavaScript applicativo.