Columns - Media Manager
Columns
By default the table shows four columns: thumbnail, name and status, creation date, and type. Replace them with your own list with columns inside context:
settings: {
context: {
type: 'myMedia',
columns: {
type: 'custom',
columns: [
{ predefined: 'kalturaCategoryAdapter', column: 'thumbnail' },
{ predefined: 'kalturaCategoryAdapter', column: 'nameAndStatus' },
{ id: 'owner', header: 'Owner', predefined: 'text', propName: 'userId' },
{ predefined: 'kalturaCategoryAdapter', column: 'createdAt' },
],
},
},
}
Columns appear in the order you list them. columns: { type: 'default' }, or no columns, keeps the default four.
Built-in Columns
Use the table's own columns with predefined: 'kalturaCategoryAdapter':
column | Shows |
|---|---|
thumbnail | The thumbnail, with the duration and a fallback icon per media type |
nameAndStatus | The entry name and its processing status. Clickable when there is a select action. |
createdAt | The creation date |
mediaType | The media type, such as Video or PDF |
In a category context, include nameAndStatus: it is the only column that shows folder names and opens folders. Without it, users can't open subcategories, and the console warns about it.
Your Own Columns
Every column you define needs an id, and can set header, width and minWidth (CSS values such as '150px').
Text
{ id: 'owner', header: 'Owner', predefined: 'text', propName: 'userId', numberOfLines: 1 }
Shows the entry's propName field as text, clamped to numberOfLines.
Date
{ id: 'updated', header: 'Updated', predefined: 'date', datePropName: 'updatedAt', dateFormat: 'DD/MM/YYYY' }
Shows a date field. dateFormat uses tokens such as DD, MM and YYYY.
Status
{
id: 'review',
header: 'Review',
predefined: 'status',
propName: 'reviewStatus',
statusLabels: { approved: 'Approved', pending: 'Pending' },
statusColors: { approved: 'success', pending: 'warning' },
}
Shows a field's value as a colored status. statusLabels maps values to text, and statusColors maps them to 'default', 'success', 'warning' or 'error'.
Draw Your Own Cells
For anything else, use predefined: null and draw the cell yourself. The table gives you an empty div for each cell, and you render into it with any framework or plain DOM:
{
id: 'review',
header: 'Review',
width: '160px',
predefined: null,
onMounted: ({ div, item }) => {
div.textContent = item.reviewStatus ?? '-';
},
onUnmounted: ({ div, item }) => {
// clean up anything you attached to div
},
onClick: (item) => openReview(item.id),
}
| Field | Description |
|---|---|
onMounted({ div, item }) | Required. Render into div. item is the entry. |
onUnmounted({ div, item }) | Clean up, for example unmount a React root. |
onClick(item) | Makes the cell clickable, and focusable with Enter or Space. |
numberOfLines | Clamps the cell's text. |
When an entry's data changes, for example after a refresh or a processing check, the cell is unmounted and mounted again with the new item.
If you render with React, give each cell its own root:
import { createRoot } from 'react-dom/client';
const roots = new WeakMap();
const reviewColumn = {
id: 'review',
header: 'Review',
predefined: null,
onMounted: ({ div, item }) => {
const root = createRoot(div);
roots.set(div, root);
root.render(<ReviewBadge status={item.reviewStatus} />);
},
onUnmounted: ({ div }) => {
roots.get(div)?.unmount();
roots.delete(div);
},
};
Show Data from Your Own Systems
Columns read fields from the entry. To show data that isn't on the Kaltura entry, add it to each entry with the postGetMediaList interceptor, then point a column at that field:
interceptors: {
postGetMediaList: async ({ entries }) => {
const statuses = await fetchReviewStatuses(entries.map((e) => e.id));
return entries.map((e) => ({ ...e, reviewStatus: statuses[e.id] }));
},
},
columns: {
type: 'custom',
columns: [
{ predefined: 'kalturaCategoryAdapter', column: 'thumbnail' },
{ predefined: 'kalturaCategoryAdapter', column: 'nameAndStatus' },
{
id: 'review',
header: 'Review',
predefined: 'status',
propName: 'reviewStatus',
statusLabels: { approved: 'Approved', pending: 'Pending' },
statusColors: { approved: 'success', pending: 'warning' },
},
],
},