I have a smartgrid, thus:
grid = SQLFORM.smartgrid(db.exsystem,linked_tables=['exsystem', 'disks'],
user_signature=False,
deletable=False,
links = [
lambda row:
A(
SPAN(_class='icon play icon-play glyphicon glyphicon-play')
,'Start'
,_class='button btn btn-success',_title='Start'
,_href=URL(args=["exsystem/start", db.exsystem,
row.id])
),
lambda row:
A(
SPAN(_class='icon stop icon-stop glyphicon glyphicon-stop')
,'Stop'
,_class='button btn btn-warning',_title='Stop'
,_href=URL(args=["exsystem/stop", db.exsystem,
row.id])
),
lambda row:
A(
SPAN(_class='icon trash icon-trash glyphicon glyphicon-bin')
,'Delete'
,_class='button btn btn-danger',_title='Delete'
,_href=URL(args=["exsystem/delete", db.exsystem,
row.id])
)
]
)
So this displays coloured buttons for stop, start, and delete.
Ideally, I'd like the stop button to be suppressed if the entity in question is already stopped (based on db.exsystem.system_status)
Or, the button function and URL and type could be changed, depending on system status
I don't like having button for 'stop' on a thing which is already 'stopped'
These are controls for a virtual machine manager page.
How can I do this please?