Versão atual:

wdkAddChild is not defined

Pessoal, estou tentando fazer uma função customizada para adicionar uma nova linha em uma table pai e filho, mas, ao clicar no button a mensagem de erro, anexo, aparece no log do browser. Já tentei colocar a function wdkAddChild direto no button, mas, o erro persiste.

Me ajudem...

Screenshot from 2020-08-19 15-10-01.png

HTML

<!DOCTYPE html>
<html>

<head>
    <link rel="stylesheet" type="text/css" href="/style-guide/css/fluig-style-guide.min.css">
    <script src="/resources/js/jquery/jquery.js"></script>
    <script src="/resources/js/jquery/jquery-ui.min.js"></script>
    <script src="/resources/js/mustache/mustache-min.js"></script>
    <script src="/style-guide/js/fluig-style-guide.min.js"></script>

    <!-- CUSTOM -->
    <link href="/style-guide/css/fluig-style-guide-filter.min.css" rel="stylesheet" type="text/css">
    <link href="/style-guide/css/fluig-style-guide-ratingstars.min.css" rel="stylesheet" type="text/css">
    <script src="/style-guide/js/fluig-style-guide-filter.min.js"></script>
    <script src="/style-guide/js/fluig-style-guide-ratingstars.min.js"></script>

    <link href='/webdesk/customresources?cid=1&resourceName=temaFormulario/0.css' type='text/css' rel='stylesheet' />

    <link rel="stylesheet" type="text/css" href="/style-guide/css/fluig-style-guide-addtocalendar.min.css">
    <script src="/style-guide/js/fluig-style-guide-addtocalendar.min.js"></script>

    <link rel="stylesheet" href="./css/style.css">
</head>

<body class="fluig-style-guide">
    <form style="padding-left: 10px; padding-right: 10px;">
        <div class="panel panel-primary">
            <div class="panel-heading">
                <h2 class="panel-title">Plano de Ação</h2>
            </div>
            <div class="panel-body">
                <!-- Nav Tabs -->
                <ul class="nav nav-tabs" role="tablist">
                    <li class="active" style="width: 15%">
                        <a href="#divRowActionPlan" role="tab" data-toggle="tab">
                            <span class="fluigicon fluigicon-school-note icon-sm"></span>
                            <strong>Plano de ação</strong>
                        </a>
                    </li>
                    <li style="width: 15%">
                        <a href="#divRowActivities" role="tab" data-toggle="tab">
                            <span class="fluigicon fluigicon-enrollment-verified icon-sm"></span>
                            <strong>Atividades</strong>
                        </a>
                    </li>
                </ul>
                <div class="tab-content">
                    <!-- div for Activities -->
                    <div class="tab-pane fade" id="divRowActivities">
                        <div class="col">
                            <div class="col-md-12" data-isolated-scroll="" style="zoom: 1;">
                                <div id="datatable-area" class="panel-heading fs-no-padding-left fs-no-padding-right">
                                    <div class="row fs-no-margin">
                                        <div id="datatable-area-action" class="fs-no-padding-left col-md-6">
                                            <button type="button" class="btn btn-primary" data-datatable-add-row="" id="buttonAddActivity"
                                                onclick="wdkAddChild('tableActivitiesActionPlan')">
                                                Adicionar atividade
                                            </button>
                                            <button class="btn btn-primary" data-datatable-del-row="">Remover</button>
                                            <button class="btn btn-primary" data-datatable-edit-row="">Editar</button>
                                        </div>
                                    </div>
                                </div>
                                <div class="table-responsive col-md-12 col-sm-12">
                                    <table id="tableActivitiesActionPlan" class="table" tablename="tableActivitiesActionPlan"
                                        nodetetebutton="true" noaddbutton="true">
                                        <thead>
                                            <tr class="tableHeadRow">
                                                <th class="tableColumn" scope="col">Cód.</th>
                                                <th class="tableColumn" scope="col">Pred.</th>
                                                <th class="tableColumn" scope="col">O que?</th>
                                                <th class="tableColumn" scope="col">Responsável</th>
                                                <th class="tableColumn" scope="col">Prazo</th>
                                                <th class="tableColumn" scope="col">Previsão/Realizado</th>
                                                <th class="tableColumn" scope="col">% Conc.</th>
                                                <th class="tableColumn" scope="col">Status</th>
                                                <th class="tableColumn" scope="col">Onde?</th>
                                                <th class="tableColumn" scope="col">Como?</th>
                                                <th class="tableColumn" scope="col">Porque?</th>
                                                <th class="tableColumn" scope="col">Dt. ínicio</th>
                                                <th class="tableColumn" scope="col">Quanto?</th>
                                                <th class="tableColumn" scope="col"></th>
                                            </tr>
                                        </thead>
                                        <tbody data-tbody-fluig="">
                                            <tr class="tableBodyRow">
                                                <td class="fs-v-align-middle"></td>
                                                <td class="fs-v-align-middle"></td>
                                                <td class="fs-v-align-middle"></td>
                                                <td class="fs-v-align-middle"></td>
                                                <td class="fs-v-align-middle"></td>
                                                <td class="fs-v-align-middle"></td>
                                                <td class="fs-v-align-middle"></td>
                                                <td class="fs-v-align-middle"></td>
                                                <td class="fs-v-align-middle"></td>
                                                <td class="fs-v-align-middle"></td>
                                                <td class="fs-v-align-middle"></td>
                                                <td class="fs-v-align-middle"></td>
                                                <td class="fs-v-align-middle"></td>
                                            </tr>
                                        </tbody>
                                        <tfoot>
                                        </tfoot>
                                    </table>
                                </div>
                                <div id="area-nav-button" class="text-right fs-md-margin-bottom" style="display: none;">
                                    <button class="btn btn-default" data-nav-prev="" disabled=""> &lt;&lt; </button>
                                    <button class="btn btn-default" data-nav-next=""> &gt;&gt; </button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>
    <script type="text/javascript" src="./js/paneActionPlan.js"></script>
    <script type="text/javascript" src="./js/paneActivities.js"></script>
    <script type="text/javascript" src="./js/app.js"></script>
    <script src='/webdesk/vcXMLRPC.js' type="text/javascript"></script>
</body>

</html>

JS

const tableActivities = $('tableActivitiesActionPlan');


buttonAddRow.on('click', () => { toCreateNewActivityRow(tableActivities) });

// function to create a new line on table of activities
function toCreateNewActivityRow(table) {
  let addRow = wdkAddChild(table);
}

Versão (1):

Ver a versão formatada

wdkAddChild is not defined

Comentário

new question