cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
mhaz
Level I

How to dynamically create a column of buttons

Hi all,
I`m trying to create a dashboard where i will have a DT and in the end of each row/last column i will have a button that refers to that specific row. Tried to create a list of buttons but it's not working.

 

m1 = Button Box("m1", x=3;);
m2 = Button Box("m2", x=3;);
list = {m1,m2};

mm =H List Box();

for(i=1, i<3, i++,
mm << Append(eval(list[i]));
);

sr=New Window("Summary Results",
TableBox(
stringColBox("Layer",layerList),
stringColBox("Param",rezparamList),
stringColBox("Test Criteria",crtList),
stringColBox("Flag",flagList),

stringColBox("button",List)

));

1 ACCEPTED SOLUTION

Accepted Solutions
pmroz
Super User

Re: How to dynamically create a column of buttons

You can use colbox to add buttons, or pretty much anything.

alist = {"a", "b", "c"};
nlist = {1, 2, 3};

nw = new window("Buttons in Tablebox",
	tb = tablebox(
		stringcolbox("ABC", alist),
		numbercolbox("123", nlist),
		bb = colbox("Buttons")
	)
);

bblist = {};
for (i = 1, i <= nitems(alist), i++,
	bb_expr = evalinsert("\[bblist[i] = buttonbox("Button #" || char(i), print(^i^))]\");
	eval(parse(bb_expr));
	bb << append(bblist[i]);
);

I had to create an expression or the action printed out the current value of i, namely 4.

Tablebox Buttons.png

View solution in original post

3 REPLIES 3
txnelson
Super User

Re: How to dynamically create a column of buttons

I am not aware of any way to add a Button Box() to a Table Box(), in the same manner in which a Radio Box() can be added. (Maybe some other user is aware of such a method).

I can envision that you could use a Radio Button() that when selected would do what you want a Button Box() to do.  I can also envision just using the Table Box() selection capability to trigger the same functionality.

See correct response below in Pete's response

Jim
pmroz
Super User

Re: How to dynamically create a column of buttons

You can use colbox to add buttons, or pretty much anything.

alist = {"a", "b", "c"};
nlist = {1, 2, 3};

nw = new window("Buttons in Tablebox",
	tb = tablebox(
		stringcolbox("ABC", alist),
		numbercolbox("123", nlist),
		bb = colbox("Buttons")
	)
);

bblist = {};
for (i = 1, i <= nitems(alist), i++,
	bb_expr = evalinsert("\[bblist[i] = buttonbox("Button #" || char(i), print(^i^))]\");
	eval(parse(bb_expr));
	bb << append(bblist[i]);
);

I had to create an expression or the action printed out the current value of i, namely 4.

Tablebox Buttons.png

mhaz
Level I

Re: How to dynamically create a column of buttons

The colbox solution is just what i was looking for.

Didn't know about the Table Box() selection option  and it was perfect to different project.

Thank you!!