Custom Table Components
Building your own data grid when the list component runs out of road
Posts 7 and 14 covered how far the built-in list component goes. This one starts where it stops.
You’ll know when you get there. Someone wants inline editing across rows, or a column that computes from three others, or expandable detail rows, or a layout that isn’t a table at all on mobile. At some point configuring the list is more work than building your own.
Before you build one
Be sure. A custom component means you now own pagination, sorting, filtering, accessibility, keyboard navigation, loading states, empty states and error handling - all of which the built-in list already does.
The test: write down what you need that the list can’t do. If it’s one thing, look harder for a way to configure or extend around it. If it’s four things, build.
Step by step
1. Get the data
Use the Power Pages Web API rather than inventing a data path. Table permissions still apply, which is the point - your custom component should be exactly as secure as the built-in one because it goes through the same door.
Fetch server-side-shaped: request the page you’re displaying, sorted and filtered by the server. Pulling everything and slicing it in JavaScript works in development against test data and falls over on real volumes.
2. Separate data from rendering
Keep three things apart: something that fetches, something that holds state (current page, sort, filters, selection), and something that renders. Mixing them is what makes grids unmaintainable.
The state object is the interesting one. Every user interaction changes state, and every state change triggers a fetch or a re-render. Make that flow explicit and one-directional.
3. Render
Build it as a real table unless you have a reason not to - <table>, <thead>, <th scope>. Screen readers understand tables. They don’t understand a grid of divs, and retrofitting ARIA onto one is more work than using the right element.
Sortable headers need to be buttons, not click handlers on a <th>. Keyboard users need to reach every action.
4. Handle the states nobody demos
Loading, empty, error, and “filtered down to nothing” are four different states with four different messages. The default list handles these; your component won’t unless you write them.
“No results for that filter, clear filters” is a better empty state than a blank rectangle, and it takes ten minutes.
5. Mobile
A wide table on a phone is a horizontal scroll nobody enjoys. The usual answers: hide low-priority columns, collapse each row into a card, or make the table scroll inside its own container with the first column pinned.
Pick one deliberately rather than discovering what happens by accident.
How to make a mess and fix it
Fast in dev, slow in production. You’re paging in the browser. Move it to the server.
Records missing that should be there. Table permissions - the Web API enforces them, which is correct. Check the permission, not the component.
Unusable with a keyboard or screen reader. Usually semantic markup. Real table elements, real buttons.
Memory climbing as people page through. You’re not cleaning up listeners on rows you replace.
Wrapping up
Custom table components are worth it when you need several things the built-in list can’t do. Go through the Web API so security stays consistent, keep data, state and rendering separate, use real table markup, and write the boring states.
Useful links
- Lists: what the built-in component does
- Web API overview
- Web API read operations, paging and filtering
- Handle Web API HTTP requests and errors
- Use code components (PCF) in Power Pages
Next: API integration and the Web API in more depth.