Multiple Button Groups

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
sangnandar
User
Posts: 980

Multiple Button Groups

Post by sangnandar »

I need to create multiple button group so some links will be grouped to ButtonGroup1 and another links grouped to ButtonGroup2.
I thought of something like this,
ListOptions_Load
$item1->ShowInButtonGroup1 = TRUE;
$item1->ShowInButtonGroup2 = FALSE;
$item2->ShowInButtonGroup1 = FALSE;
$item2->ShowInButtonGroup2 = TRUE;

Any idea how ?

Thanks.


arbei
User
Posts: 9355

Post by arbei »

There are no such properties. Did you mean splitting the existing button group into two?

If they are not already existing, you need to create multiple button groups and add your items to the corresponding button group yourself. Enable the options "Use button dropdown for links" then generate the scripts. Then you can reference the logic in the function "RenderListOptions" in the list page of the table as example. And write your own script in ListOptions_Load and ListOptions_Rendered Server Event.

If you create the button groups from scratch, Also read: https://getbootstrap.com/docs/3.3/compo ... btn-groups


sangnandar
User
Posts: 980

Post by sangnandar »

arbei wrote:
There are no such properties. Did you mean splitting the existing button group into two?

Yes.

I can only found this,
function RenderListOptions()

Line 12-18, fetch links as array
$links = array();
foreach ($this->ListActions->Items as $listaction)

Line 23-29, links grouped into a button group
if (count($links) > 1)
foreach ($links as $link)

I didn't see how to create the second button group.


digitalphotoworld
User
Posts: 416
Location: Nürnberg/Germany

Post by digitalphotoworld »

Create a new column in ListOptions Load event, call it "group2" for example.

$opt = &$this->ListOptions->Add("group2");
$opt->Header = "";
$opt->OnLeft = TRUE; // Link on left
$opt->MoveTo(0); // Move to first column

Then in ListOptions Render event you can create your group of buttons in this new column.

$body = '
<div class="btn-group" role="group" >
<button type="button" class="btn btn-default">first</button>
<button type="button" class="btn btn-default">second</button>
<button type="button" class="btn btn-default">third</button>
</div> ';

$this->ListOptions->Items["group2"]->Body = $body;


Post Reply