Custom buttons

Custom buttons

MurrayMurray Posts: 14Questions: 5Answers: 0

I use

        columns: [
            { title: "Id" },
            { title: "First name" },
            { title: "Last name" },
            { title: "Email" },
            { title: "Phone" },
            { title: "Mobile" },
            { title: "", "defaultContent": "<button onclick='edituser();'>Edit</button>" },
            { title: "", "defaultContent": "<button onclick='deleteuser();'>Delete</button>" },

to add 2 custom buttons to the table. They both work, however, if I click on the Edit button, complete editing then click on the Delete button, I get the edit screen again. If I click on the Delete button before the Edit, I get the correct Delete screen. What do I need to add to sort this out please.


  • colincolin Posts: 12,604Questions: 0Answers: 2,154

    If this using Editor, or another way of editing the table?


  • MurrayMurray Posts: 14Questions: 5Answers: 0

    The Edit button runs this javascript function which calls my own edit screen.

      function edituser() {
        jQuery('#users tr').click(function(e) {
            var $this = jQuery(this);
            var trid = $this.closest('tr').attr('id');
            if (trid === undefined) {
                var trid = $this.prev('tr').attr('id');
            var x = 0, y = 0; // default values 
        x = window.screenX +5;
        y = window.screenY +250;'../admin/edituser.php?id='+trid,'edituser','toolbar=0, scrollbars=1, height=400, width=800, resizable=1,left='+x+',screenX='+x+',top='+y+',screenY='+y);
  • kthorngrenkthorngren Posts: 13,780Questions: 25Answers: 3,242

    Probably will need to see the code in action to help debug. Please post a link to your page or a test case replicating the issue so we can understand the code flow.


  • MurrayMurray Posts: 14Questions: 5Answers: 0

    Problem resolved by coding thus:
    { title: "", "defaultContent": "<button class=\"view\">View Tests</button><button class=\"test\">Run Test</button><button class=\"edit\">Edit</button><button class=\"delete\">Delete</button><button class=\"addtest\">Add Test</button>" },
    although these buttons then do not work when pushed onto a lower row on screen resizing. I have asked a new question in that regard.
    Thank you for looking at this.

Sign In or Register to comment.