How to select a row

How to select a row

Rudi_SchloesserRudi_Schloesser Posts: 14Questions: 3Answers: 1

I'm using select and have a checkbox within the header to select all rows in a table.
I'm able to change the state of all checkboxes within the table by using a event handler

$('#cfg-all').on('click', function() { var rows = $('#config').DataTable().rows({ 'search': 'applied' }).nodes(); $('input[type="checkbox"]', rows).prop('checked', this.checked); });

but, using the button plugin the buttons extending "selected" stay disabled.

Any solution?

Answers

  • jLinuxjLinux Posts: 981Questions: 73Answers: 75
    edited November 2015

    Can we replicate this somewhere? If not, Create the script on live.datatables.net so we can replicate it

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    You probably need to call the change event on at least one of the checkboxes in the table so whatever change event handler will be called. However, as jLinux says, to confirm we'd need a test case.

    Allan

  • Rudi_SchloesserRudi_Schloesser Posts: 14Questions: 3Answers: 1

    Hi jLinux and Allan,
    thanks for your answers. I tried to setup a script on live.datatables.net but I didn't succeed to get the button displayed at all.
    I also tried, following Allans recommendation to use the change event, but without success.
    I will leave it out for the moment, now fighting with a inline upload field...

  • Rudi_SchloesserRudi_Schloesser Posts: 14Questions: 3Answers: 1

    Dear all,
    I try to have a table with grouping with a button in the group row, to add additional entries to this particular group. Following the grouping example within the drawCallback I assign an ID to the <a href=""...> which I can use in the event handler to get the data entry of the first row of tis group. In the event handler ('click') I would like to create a new row, populating it with the default values of the group (i.e. group ID, etc.) and pass it to the editor.edit() function.
    I tried a two steps approach, adding a new row (with table.row.add()) to the table, which can be edited afterwards. But: After editing the row, a new row with the correct values is added
    to the table, but the "old" entry with the defaults is also still there in addition.

    Any solution for this?

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    We would need a link to a test page showing the issue with step by step instructions on how the error can be reproduced.

    Allan

  • Rudi_SchloesserRudi_Schloesser Posts: 14Questions: 3Answers: 1

    Hi Allan,
    thanks for fast response. It's difficult to provide a link, because the server is running on an embedded system, which is not connected to the internet. I would have to bring the server onto a Webserver available from the outside world.
    But already one step further: In the two steps approach it's related to the srcID, which I don't know at the time of row creation. Have to find a way around. Best would be, to be able to create a new row with defaults and pass it directly to the editor. Any way to do so?

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    Best would be, to be able to create a new row with defaults and pass it directly to the editor. Any way to do so?

    Use the Editor API I would imagine - create() and then field().val() to set values. submit() will submit the form.

    Allan

  • Rudi_SchloesserRudi_Schloesser Posts: 14Questions: 3Answers: 1

    Hi Allan,
    yes, that's for sure a possible solution, but at a late stage (The editor is already displayed and the Add button already clicked), thus changing values in the message send to the server. So the information is added behind the scenes and not fully visible to the user.

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    I'm afraid I'm not really understanding here. If you want to alter the data that is being sent to the server you would use preSubmit.

    Allan

  • Rudi_SchloesserRudi_Schloesser Posts: 14Questions: 3Answers: 1

    Hi Allan,
    following your last hint I found a solution.
    Many thanks,
    Rudi

This discussion has been closed.