Hi,
We want to have Patient ID as a column in the Samples Table.
As it defined in Senaite.App.Lisitng manual:
- Created own subscriber:
class PatientSamplesView(object):
adapts(IListingView)
implements(IListingViewAdapter)
def __init__(self, listing, context):
self.listing = listing
self.context = context
def before_render(self):
self.listing.columns["PatientID"] = {
"title": "Patient ID",
"toggle": True,
"sortable": True,
}
def folder_item(self, obj, item, index):
obj = api.get_object(obj)
patient = get_obj_from_field(obj, 'Patient', None)
patient_id = api.get_id(patient)
patient_url = api.get_url(patient)
item["PatientID"] = patient_id
item["replace"]["PatientID"] = get_link(pa_url, value=patient_id)
return item
- Registred adapter in
configure.zcml
As the result:
- adapter works;
- AJAX-request delivers Patient ID values for each table item;
- column name added to “Configure table columns” - section (where you can toggle and reorder columns);
BUT column not showing in the Samples table. No manipulations help (resetting/reorder columns).
Any idea where to look?
Plone ver: 5.2.4
Senaite.lims: 2.x (latest)
Senaite.core: 2.x (latest)