Jump to content

putting a checkbox in a column of markupadmindatatable, outputted a plain text


adrianmak
 Share

Recommended Posts

I'm building a form with a markupadmindatatable, one of column is a checkbox for each row, selection for deletion.

      $out .= "<form action='save' method='post'>";

        $table = $this->modules->get("MarkupAdminDataTable");
        $table->headerRow(["Name", "Email", "Subject", "Content"]);
	
        
        $listing = $this->pages->get(1024)->children();
        foreach($listing as $p) {

            $checkbox = "<input name='guestbook[]' id='guestbook_{$p->id}' value='{$p->id}' type='checkbox'>";
            $data = array(
                $p->title=>$config->urls->admin."../page/edit/?id=".$p->id,
                $p->g_email,
                $p->g_subject,
                $p->g_content,
                $checkbox
            );
            $table->row($data);
        }               
        
        $out .= $table->render();
    
        $out .= "<button class='ui-button ui-widget ui-corner-all head_button_clone ui-state-default' name='submit_delete_field' value='Delete' type='submit'><span class='ui-button-text'>Delete</span></button>";
        $out .= "</form>";
        return $out;

post-2272-0-81176600-1453683841_thumb.pn

Link to comment
Share on other sites

another minor  problem is, I out the checkbox prior of the name

$checkbox.$p->title=>$config->urls->admin."../page/edit/?id=".$p->id,

However, the outputted markup, the input checkbox is wrapped by anchor link,

post-2272-0-46999200-1453688217_thumb.pn
the result is clicking the checkbox will redirect to page edit.

How could i display the checkbox out of the anchor link

Link to comment
Share on other sites

This is MarkupAdminDataTable's expected behavior (wrapping the value in a link to the key) if you pass an associative entry to row(), so you'll have to build the complete HTML snippet for the column manually. Or, even better, make the checkbox and the link separate columns.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...