Change the Table field Header name in the example add row

Change the Table field Header name in the example add row

djpeterlewisdjpeterlewis Posts: 4Questions: 1Answers: 0

Hi All,

I am trying to change the addrow Header field names. I have searched all the html, css and js files and I cannot find it that makes a difference

I found one that might have worked and I changed it but it made NO difference

datatables-add-rows.js

also did this

   <thead class="thead-sm text-uppercase fs-xxs">
                                    <tr>
                                        <th>Shopping Centre</th>
                                        <th>Code</th>
                                        <th>Province</th>
                                        <th>City</th>
                                        <th>Suburb</th>
                                        <th>Monthly Traffic</th>
                                        <th>Posters</th>
                                        <th>Status</th>
                                    </tr>
                                </thead>

Thank you

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 65,610Questions: 1Answers: 10,909 Site admin

    Hi,

    Can you link to a test case showing the issue please? I'm not entirely sure what you mean by the "addrow header field names".

    Thanks,
    Allan

  • djpeterlewisdjpeterlewis Posts: 4Questions: 1Answers: 0

    Hi Allan

    I have tried by loading all the files into this site but it does not even give the wrong result

    https://onecompiler.com/html/44fjwvp7b

    Thanks

  • djpeterlewisdjpeterlewis Posts: 4Questions: 1Answers: 0

    This is the table but the Header of the table is wrong , this is the code for it

    I tested if it is reading the html by changing the data and it changed, so I know it is the correct code I am working on. If I delete the table header code it still is the same , the header does not go away but still displays the incorrect result.
    Cleared cache

    This is the link on your site of what I am doing.

    https://datatables.net/examples/api/add_row.html

    I also want to change the Button name from Add Row to Add Shopping Centre
    I expected this will be inside the CSS , but searched all files

    Thank you

  • djpeterlewisdjpeterlewis Posts: 4Questions: 1Answers: 0
    edited March 7

    I did notice if I deleted this line
    assets/plugins/datatables/dataTables.min.js"
    Then I get the correct table header but none of the features are there ie, add row, column sort

  • kthorngrenkthorngren Posts: 22,412Questions: 26Answers: 5,153
    edited March 7 Answer ✓

    I get Access Denied when clicking your first link. Without seeing your specific code it's hard to suggest changes.

    This is the table but the Header of the table is wrong

    My guess is you have columns.title set which will change the header names defined in HTML.

    I also want to change the Button name from Add Row to Add Shopping Centre

    For that example the button is defined in the HTML. Use the browser's inspector and you will find this element:

    <button id="addRow">Add new row</button>
    

    This is where to change the button's title. Might be different in your solution.

    If you still have questions then at a minimum please post your Datatables initialization code. Better is a link to a test case showing the issue. You can build a minimal test case showing the issues with the steps here:
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Possibly just start with this by updating the HTML table and adding your initialization code.
    https://live.datatables.net/

    Kevin

Sign In or Register to comment.