Refresh table by checkbox

Refresh table by checkbox

antoniocibantoniocib Posts: 277Questions: 62Answers: 1

how to add the refresh of table when i check the checkbox?

This question has accepted answers - jump to:

Answers

  • rf1234rf1234 Posts: 2,934Questions: 87Answers: 415
  • kthorngrenkthorngren Posts: 21,132Questions: 26Answers: 4,918

    Got your message with the link to your example. Use the browser's inspector to tool to watch one of your rows. Check the checkbox and you will see the inline editor adds then removes the class highlight. This is the class you are using to highlight checked rows. Try changing the class name to something else to see if it helps.

    Kevin

  • antoniocibantoniocib Posts: 277Questions: 62Answers: 1

    Ehm kevin i dont understand what u means?

  • kthorngrenkthorngren Posts: 21,132Questions: 26Answers: 4,918
    Answer ✓

    Right click on one of your rows then click Inspect. Toggle the checkbox fo that row and you will see the highlight class added then removed. This is the inline editor process. I think this is overwriting the highlight class you are adding in the rowCallback. Change the name class you are using in the rowCallback so it doesn't conflict.

    Kevin

  • antoniocibantoniocib Posts: 277Questions: 62Answers: 1

    Kevin is impossible for me understand what u means can u do an example because the translator is a shit.

  • antoniocibantoniocib Posts: 277Questions: 62Answers: 1

    Use my code for the example please

  • kthorngrenkthorngren Posts: 21,132Questions: 26Answers: 4,918
    Answer ✓

    Change the class name you are using to something else like myHighlight, for example:

    rowCallback: function ( row, data ) {
            // Set the checked state of the checkbox in the table
            $('input.editor-active', row).prop( 'checked', data.active == 1 );
            if ( data.active == 1 ) {
                    $(row).addClass('myHighlight')
     
                }
    },
    

    Then change your CSS to match this name.

    Kevin

  • kthorngrenkthorngren Posts: 21,132Questions: 26Answers: 4,918
    Answer ✓

    You probably also will need to remove the myHighlight class if data.active is not 1. For example:

    rowCallback: function ( row, data ) {
            // Set the checked state of the checkbox in the table
            $('input.editor-active', row).prop( 'checked', data.active == 1 );
            if ( data.active == 1 ) {
                    $(row).addClass('myHighlight')
                } else {
                    $(row).removeClass('myHighlight')
                }
    },
    

    Kevin

  • antoniocibantoniocib Posts: 277Questions: 62Answers: 1

    Ty KEEEVIN!

  • antoniocibantoniocib Posts: 277Questions: 62Answers: 1

    It works !

This discussion has been closed.