Uncaught TypeError: nTd is undefined

Uncaught TypeError: nTd is undefined

zexerezexere Posts: 4Questions: 1Answers: 0
edited August 2020 in Free community support

Can't add test link because needs DB.
My problem with error nTd when I add anything else to first <tbody>.

_<tbody>
                    {% for e in entry %}
                        {% if 'Центральний р-н' in e[10] %}
                          <tr>
                            {% for elem in e[:10] %}
                                <td>{{elem}}</td>
                            {% endfor %}
                          </tr>
                        {% endif %}
                    {% endfor %}
                </tbody>_
That working okey, but if i Add anything in top or bottom i have a error nTd
_<tbody>
                    <tr>
                      <td class="colorfull" colspan=10>СТ "Авангард"</td>
                    </tr>
                    {% for e in entry %}
                        {% if 'Центральний р-н' in e[10] %}
                          <tr>
                            {% for elem in e[:10] %}
                                <td>{{elem}}</td>
                            {% endfor %}
                          </tr>
                        {% endif %}
                    {% endfor %}
                </tbody>_

<thead> look like this:

_<thead>
                     <tr style="font-weight:bold">
                         <th  rowspan="2">№ вул</th>
                         <th  rowspan="2">Тип</th>
                         <th  rowspan="2">Назва українською</th>
                         <th  rowspan="2">Назва росiйською</th>
                         <th colspan="3">Документ про присвоєння чи зміну найменування</th>
                         <th  rowspan="2">Мiсцерозташування на територiї</th>
                         <th  rowspan="2">Попередня назва чи написання</th>
                         <th  rowspan="2">Примiтка</th>
                      </tr>
                     <tr style="font-weight:bold">
                         <th>Дата</th>
                         <th>Номер</th>
                         <th>Видавник</th>
                      </tr>_

And if i add like this all work fine:

_<tbody>
                    <tr>
                         <td>№ вул</td>
                         <td>Тип</td>
                         <td>Назва українською</td>
                         <td>Назва росiйською</td>
                         <td>Дата</td>
                         <td>Номер</td>
                         <td>Видавник</td>
                         <td>Мiсцерозташування на територiї</td>
                         <td>Попередня назва чи написання</td>
                         <td>Примiтка</td>
                    </tr>
                    {% for e in entry %}
                        {% if 'Центральний р-н' in e[10] %}
                          <tr>
                            {% for elem in e[:10] %}
                                <td>{{elem}}</td>
                            {% endfor %}
                          </tr>
                        {% endif %}
                    {% endfor %}
                </tbody>_

Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Answers

  • kthorngrenkthorngren Posts: 20,250Questions: 26Answers: 4,761

    Doesn't look like you have a th element for each column. See this example for Complex Headers and this HTML Requiremes doc.

    Kevin

  • zexerezexere Posts: 4Questions: 1Answers: 0

    Problem more interesting
    I have 2 tbody and 1 thead

    <thead>
                         <tr style="font-weight:bold">
                             <th  rowspan="2">№ вул</th>
                             <th  rowspan="2">Тип</th>
                             <th  rowspan="2">Назва українською</th>
                             <th  rowspan="2">Назва росiйською</th>
                             <th  colspan="3">Документ про присвоєння чи зміну найменування</th>
                             <th  rowspan="2">Мiсцерозташування на територiї</th>
                             <th  rowspan="2">Попередня назва чи написання</th>
                             <th  rowspan="2">Примiтка</th>
                          </tr>
                         <tr style="font-weight:bold">
                             <th>Дата</th>
                             <th>Номер</th>
                             <th>Видавник</th>
                          </tr>
                    </thead>
                    <tbody>
                        {% for e in entry %}
                            {% if 'Центральний р-н' in e[10] %}
                              <tr>
                                {% for elem in e[:10] %}
                                    <td>{{elem}}</td>
                                {% endfor %}
                              </tr>
                            {% endif %}
                        {% endfor %}
                    </tbody>
                    <tbody>
                        <tr>
                          <td class="colorfull" colspan=10>СТ "Авангард"</td>
                        </tr>
                         <tr style="font-weight:bold">
                             <td>№ вул</td>
                             <td>Тип</td>
                             <td>Назва українською</td>
                             <td>Назва росiйською</td>
                             <td>Дата</td>
                             <td>Номер</td>
                             <td>Видавник</td>
                             <td>Мiсцерозташування на територiї</td>
                             <td>Попередня назва чи написання</td>
                             <td>Примiтка</td>
                          </tr>
                          {% for e in entry %}
                            {% if 'СТ "Авангард"' in e[10] %}
                              <tr>
                                {% for elem in e[:10]%}
                                    <td>{{elem}}</td>
                                {% endfor %}
                              </tr>
                            {% endif %}
                          {% endfor %}
                    </tbody>
    

    In the second tbody all that I add is fine

    But in the first tbody colspan crash datatables if I add it

  • allanallan Posts: 61,622Questions: 1Answers: 10,090 Site admin

    DataTables doesn't support colspan in the tbody I'm afraid. That is what is causing the error in http://live.datatables.net/leqonovo/276/edit .

    Allan

  • zexerezexere Posts: 4Questions: 1Answers: 0

    But in the second tbody it supports colspan

  • allanallan Posts: 61,622Questions: 1Answers: 10,090 Site admin

    Not really. DataTables doesn't read the second tbody at all - it is just left untouched.

    Allan

This discussion has been closed.