npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@dojo-ng/data-grid-columns

v0.1.2

Published

Column resize, reorder, pin, hide, and a column chooser for @dojo-ng/data-grid

Readme

@dojo-ng/data-grid-columns

Let users resize, reorder, pin, and hide <dj-data-grid> columns, and pick columns from a chooser.

Part of Dojo NG, a framework-agnostic web component library. BSD-3-Clause.

Install

npm install @dojo-ng/data-grid-columns

Usage

Add the plugin, then keep the layout in your own storage: store each dj-column-state-change, and set columnState on load.

<dj-data-grid id="orders" height="320px"></dj-data-grid>
<script type="module">
  import "@dojo-ng/data-grid";
  import { columnsPlugin } from "@dojo-ng/data-grid-columns";
  const grid = document.getElementById("orders");
  grid.columns = [
    { id: "id", header: "Order", width: "90px", pinned: "start", hideable: false },
    { id: "customer", header: "Customer", minWidth: 120 },
    { id: "status", header: "Status" },
    { id: "total", header: "Total", width: "110px" },
  ];
  grid.data = [
    { id: 1001, customer: "Ada", status: "Shipped", total: "$42.00" },
    { id: 1002, customer: "Grace", status: "Open", total: "$18.50" },
  ];
  grid.plugins = [columnsPlugin()];

  const saved = localStorage.getItem("orders-columns");
  if (saved) grid.columnState = JSON.parse(saved);
  grid.addEventListener("dj-column-state-change", (e) => {
    localStorage.setItem("orders-columns", JSON.stringify(e.detail));
  });
</script>

How it works

  • The grid holds the layout: grid.columnState ({ sizing, order, pinning, visibility }) and the dj-column-state-change event. This plugin is the UI for it. An app that only restores a saved layout needs no plugin.
  • Resize: drag the handle at a header's end edge. Double-click it to fit the column to its widest cell. Only the rows on screen are measured, since the rest are not in the page.
  • Reorder: drag a header to a new place. Pinned columns move only among their own pinned group.
  • Column menu: Wider, Narrower, Move left, Move right, Pin left, Pin right, Unpin, Hide, and Columns…, which opens a chooser with a checkbox per column and a Reset to the declared layout. The last visible column cannot be hidden.
  • The menu button shows on header hover and keyboard focus (always on touch screens). Pass menuButton: "always" to show it in every header.

Per column

  • resizable, reorderable, and hideable (all default true), minWidth and maxWidth in pixels, and pinned: "start" or "end" as the starting value.
  • Columns added by other plugins (the checkbox column, the drag handle) get no controls. A plugin column placed before every app column stays first, and joins the pinned start group when there is one.

Keyboard

  • On the header row (ArrowUp from the first row), Space grabs a column, Left and Right move it, Space drops it, and Escape cancels; each step is announced. Enter still sorts.
  • Alt+ArrowDown, Shift+F10, or the Menu key opens the column menu, so every pointer action has a keyboard path.
  • In the body, Left and Right scroll the columns sideways when they are wider than the grid.

Save and restore

  • Storage is the app's job. Listen for dj-column-state-change, store e.detail, and set grid.columnState on load. Ids the grid no longer has are dropped, and columns added since come back at their declared place.

Rows from a server

  • Works in remote mode (rowCount): columns do not depend on which rows are loaded.

Examples

Restore a layout without the plugin

columnState is core. Setting it orders, sizes, pins, and hides columns with no UI at all.

<script type="module">
  grid.columnState = {
    order: ["status", "customer", "id", "total"],
    sizing: { customer: 220 },
    pinning: { start: ["status"], end: [] },
    visibility: { total: false },
  };
</script>