# Introducing Grouping and Filter of positions on Kite-beta.zerodha.com

**URL:** https://tradingqna.com/t/introducing-grouping-and-filter-of-positions-on-kite-beta-zerodha-com/188272
**Category:** Zerodha Feature Announcements
**Created:** [October 30, 2025, 12:02pm UTC](https://tradingqna.com/t/introducing-grouping-and-filter-of-positions-on-kite-beta-zerodha-com/188272 "2025-10-30T12:02:30Z")
**Posts on this page:** 20
**Page:** 2

<div class="post-metadata">

### Author: ![dtyxg](https://tradingqna.com/letter_avatar_proxy/v4/letter/d/bb73d2/32.png) [@dtyxg](https://tradingqna.com/u/dtyxg)
#### Post date: [February 27, 2026, 5:36pm UTC](https://tradingqna.com/t/introducing-grouping-and-filter-of-positions-on-kite-beta-zerodha-com/188272/25 "2026-02-27T17:36:27Z")

</div>

Do you mean source code ?

---

<div class="post-metadata">

### Author: ![dtyxg](https://tradingqna.com/letter_avatar_proxy/v4/letter/d/bb73d2/32.png) [@dtyxg](https://tradingqna.com/u/dtyxg)
#### Post date: [February 27, 2026, 5:36pm UTC](https://tradingqna.com/t/introducing-grouping-and-filter-of-positions-on-kite-beta-zerodha-com/188272/26 "2026-02-27T17:36:33Z")

</div>

(() =\> {  
“use strict”;

```
// ── Constants ────────────────────────────────────────────────────────────
const BUTTON_ID = "zerodha-expand-collapse-btn";
const SELECTORS = {
    section : "section.open-positions",
    header : "header.data-table-header",
    icons : "span.expand-icon",
    expanded: "expanded",
};
const COLORS = {
    expand : "#2e7d32", // green
    collapse: "#c62828", // red
};
const LABELS = {
    expand : "Expand All",
    collapse: "Collapse All",
};

// ── Helpers ──────────────────────────────────────────────────────────────

/**
 * Applies a plain object of style properties to an element.
 * Avoids inline style strings; keeps styling declarative and easy to diff.
 */
function applyStyles(el, styles) {
    Object.assign(el.style, styles);
}

/** Creates the button with all attributes set via safe DOM APIs (no innerHTML). */
function createButton() {
    const btn = document.createElement("button");
    btn.id = BUTTON_ID;
    btn.textContent = LABELS.expand; // textContent — XSS-safe
    btn.setAttribute("aria-pressed", "false");
    btn.setAttribute("title", LABELS.expand);

    applyStyles(btn, {
        marginLeft : "10px",
        padding : "3px 8px",
        cursor : "pointer",
        borderRadius: "4px",
        border : "none",
        fontWeight : "500",
        fontSize : "12px",
        color : "white",
        background : COLORS.expand,
        transition : "background 0.2s ease",
    });

    return btn;
}

/** Syncs button label, colour, and ARIA state to the current expanded flag. */
function syncButton(btn, isExpanded) {
    const label = isExpanded ? LABELS.collapse : LABELS.expand;
    btn.textContent = label;
    btn.setAttribute("aria-pressed", String(isExpanded));
    btn.setAttribute("title", label);
    applyStyles(btn, { background: isExpanded ? COLORS.collapse : COLORS.expand });
}

/**
 * Derives the true expanded state from the DOM.
 * Returns true only if every icon is currently expanded.
 */
function areAllExpanded() {
    const icons = document.querySelectorAll(SELECTORS.icons);
    if (!icons.length) return false;
    return [...icons].every(icon => icon.classList.contains(SELECTORS.expanded));
}

// ── Core logic ───────────────────────────────────────────────────────────

function injectButton() {
    // Idempotency — bail if already injected (handles SPA re-renders)
    if (document.getElementById(BUTTON_ID)) return;

    const section = document.querySelector(SELECTORS.section);
    if (!section) return;

    const header = section.querySelector(SELECTORS.header);
    if (!header) return;

    const btn = createButton();

    btn.addEventListener("click", () => {
        try {
            const icons = document.querySelectorAll(SELECTORS.icons);
            if (!icons.length) return;

            // Read actual DOM state — not an internal flag
            const currentlyExpanded = areAllExpanded();

            icons.forEach(icon => {
                const isExpanded = icon.classList.contains(SELECTORS.expanded);
                if (!currentlyExpanded && !isExpanded) icon.click();
                if ( currentlyExpanded && isExpanded) icon.click();
            });

            // Disable during settle window — prevents double-click race condition
            btn.disabled = true;

            // Defer DOM read — Zerodha updates classes asynchronously after icon.click()
            setTimeout(() => {
                // Guard — button may have been removed if user navigated away
                if (!document.getElementById(BUTTON_ID)) return;
                syncButton(btn, areAllExpanded());
                btn.disabled = false;
            }, 50);
        } catch (err) {
            // Absorb errors so a broken icon never bricks the button
            btn.disabled = false;
            console.warn("[Zerodha Ext] Error toggling positions:", err);
        }
    });

    header.appendChild(btn);

    // Defer injection sync — Zerodha's classes may not have settled on page load
    setTimeout(() => {
        if (!document.getElementById(BUTTON_ID)) return;
        syncButton(btn, areAllExpanded());
    }, 50);

    // Button is live — stop watching for it
    domObserver.disconnect();

    // Watch only the header for button removal (SPA navigation away)
    // When removed, restart the main observer to wait for it again
    removalObserver.observe(header, { childList: true });
}

// ── Observers ────────────────────────────────────────────────────────────

// Watches for the button being removed from the DOM (user navigated away)
const removalObserver = new MutationObserver((mutations) => {
    const removed = mutations.some(m =>
        [...m.removedNodes].some(node => node.id === BUTTON_ID)
    );
    if (removed) {
        removalObserver.disconnect();
        // Resume watching for the section to reappear
        domObserver.observe(document.body, { childList: true, subtree: true });
    }
});

// Watches for the positions section to appear, then injects the button
const domObserver = new MutationObserver(() => {
    if (!window.location.pathname.includes("positions")) return;
    injectButton();
});

domObserver.observe(document.body, {
    childList: true,
    subtree : true,
});

// Also attempt immediately in case the DOM is already ready
injectButton();

```

})();

 ![image](https://tradingqna.com/uploads/default/original/3X/7/e/7edafe7b6d10654e07bb92ebb1700df56e9d20d0.png)

---

<div class="post-metadata">

### Author: ![BB789](https://tradingqna.com/user_avatar/tradingqna.com/bb789/32/91597_2.png) [@BB789](https://tradingqna.com/u/BB789)
#### Post date: [February 28, 2026, 2:08am UTC](https://tradingqna.com/t/introducing-grouping-and-filter-of-positions-on-kite-beta-zerodha-com/188272/27 "2026-02-28T02:08:14Z")

</div>

Yeah… You said you can examine every line of source. Right? How do end users do that? Did you put the code in Github?

---

<div class="post-metadata">

### Author: ![DhanushK](https://tradingqna.com/letter_avatar_proxy/v4/letter/d/91b2a8/32.png) [@DhanushK](https://tradingqna.com/u/DhanushK)
#### Post date: [March 21, 2026, 4:07pm UTC](https://tradingqna.com/t/introducing-grouping-and-filter-of-positions-on-kite-beta-zerodha-com/188272/28 "2026-03-21T16:07:00Z")

</div>

We’re excited to announce that position grouping, which is already available on the web, is now live on the Kite app as well.

**Position Grouping**

1. Positions can now be grouped by None, Underlying, or Underlying & Expiry. Tapping the Group option automatically groups positions by their underlying. To switch grouping modes or turn off grouping entirely, tap the settings icon at the top and select the preferred option.  
 ![ScreenRecording_03-21-2026](https://tradingqna.com/uploads/default/original/3X/9/c/9c69fdf5c22815899d9024b6b4bcd82599e84482.gif)

* * *

1. A red indicator at the top signals when grouping or a filter is active.  
 ![77348962-61FB-463B-805C-726B3D7EC631-69463-0000180A7FF7DD15](https://tradingqna.com/uploads/default/original/3X/c/f/cf45b19f7fa24122f71c8dfab4624e08a9c96a79.png)

* * *

1. Individual groups can be collapsed or expanded by tapping the group name; it’s useful for focusing on specific positions. There’s also a Collapse/Expand All button at the top to manage all groups at once.  
 ![ScreenRecording_03-21-2026_2](https://tradingqna.com/uploads/default/original/3X/e/e/ee056947f8a7e642de91d5beb014b9b594cdd183.gif)

* * *

1. Similar to the web, grouping is remembered until the user manually logs out of the app, and relogging will lead to a reset of the applied grouping. While the filter is reset the next day.

**Multi-Selection & Exit**

Multi-selection has been significantly reworked. Previously, a long press would open a separate page for selecting positions, making it impossible to track P&L during the process. Now, multi-selection happens directly on the positions page, allowing P&L to be tracked in real time while selecting. Additionally, positions can now be exited group-wise by long-pressing on the group name.  
 ![ScreenRecording_03-21-2026_4](https://tradingqna.com/uploads/default/original/3X/a/4/a465b218f34a03c4f7d9c622b622d8f2db065273.gif)

* * *

These changes are implemented on the Orderbook, GTT, and Alerts pages as well.  
 ![ScreenRecording_03-21-2026_5](https://tradingqna.com/uploads/default/original/3X/9/6/9653198300a61c7456d748b842b64b9bcc1ee6f5.gif)

* * *

This build also has the Analyze button inside the quick basket, which was available only on the web earlier. The build is currently available in beta and will be rolled out to the live environment in the coming days.  
 ![D66D14F1-1DD1-421B-A9BF-9C8C1DC3B013](https://tradingqna.com/images/transparent.png)

---

<div class="post-metadata">

### Author: ![bharat1080](https://tradingqna.com/letter_avatar_proxy/v4/letter/b/85e7bf/32.png) [@bharat1080](https://tradingqna.com/u/bharat1080)
#### Post date: [April 29, 2026, 4:51am UTC](https://tradingqna.com/t/introducing-grouping-and-filter-of-positions-on-kite-beta-zerodha-com/188272/30 "2026-04-29T04:51:35Z")

</div>

![IMG_5217](https://tradingqna.com/uploads/default/original/3X/c/5/c5b56942ccb761244f604047ea5c57bcee0f4250.png)

Please add “DAY” filter on kite web.

---

<div class="post-metadata">

### Author: ![bharat1080](https://tradingqna.com/letter_avatar_proxy/v4/letter/b/85e7bf/32.png) [@bharat1080](https://tradingqna.com/u/bharat1080)
#### Post date: [May 15, 2026, 4:45am UTC](https://tradingqna.com/t/introducing-grouping-and-filter-of-positions-on-kite-beta-zerodha-com/188272/31 "2026-05-15T04:45:45Z")

</div>

> [@bharat1080](#):
>
> Please add “DAY” filter on kite web.

@Arockiya_Raja @siva

---

<div class="post-metadata">

### Author: ![DhanushK](https://tradingqna.com/letter_avatar_proxy/v4/letter/d/91b2a8/32.png) [@DhanushK](https://tradingqna.com/u/DhanushK)
#### Post date: [May 15, 2026, 7:04am UTC](https://tradingqna.com/t/introducing-grouping-and-filter-of-positions-on-kite-beta-zerodha-com/188272/33 "2026-05-15T07:04:29Z")

</div>

> [@bharat1080](#):
>
> Please add “DAY” filter on kite web.

It’s WIP. Should be available in a few days; we are revamping a few things wrt filters.

---

<div class="post-metadata">

### Author: ![srikanthkaramsetty](https://tradingqna.com/letter_avatar_proxy/v4/letter/s/76d3ee/32.png) [@srikanthkaramsetty](https://tradingqna.com/u/srikanthkaramsetty)
#### Post date: [May 30, 2026, 5:29pm UTC](https://tradingqna.com/t/introducing-grouping-and-filter-of-positions-on-kite-beta-zerodha-com/188272/34 "2026-05-30T17:29:49Z")

</div>

@DhanushK @Arockiya_Raja , likewise can you bring grouping of holdings based on the industry, marketcap as well? This data is already available on console with colour blocks but if the same data can be brought directly to the holdings where we can see number of holdings in a particular industry or for a given market cap, it will be even more useful especially for the mobile app users.

---

<div class="post-metadata">

### Author: ![siva](https://tradingqna.com/user_avatar/tradingqna.com/siva/32/76200_2.png) [@siva](https://tradingqna.com/u/siva)
#### Post date: [June 1, 2026, 9:10am UTC](https://tradingqna.com/t/introducing-grouping-and-filter-of-positions-on-kite-beta-zerodha-com/188272/35 "2026-06-01T09:10:25Z")

</div>

> [@srikanthkaramsetty](#):
>
> ikewise can you bring grouping of holdings

On our list of things to do, already picked it up.

---

<div class="post-metadata">

### Author: ![srikanthkaramsetty](https://tradingqna.com/letter_avatar_proxy/v4/letter/s/76d3ee/32.png) [@srikanthkaramsetty](https://tradingqna.com/u/srikanthkaramsetty)
#### Post date: [June 1, 2026, 1:30pm UTC](https://tradingqna.com/t/introducing-grouping-and-filter-of-positions-on-kite-beta-zerodha-com/188272/36 "2026-06-01T13:30:57Z")

</div>

Hope to see it soon on the app.

---

<div class="post-metadata">

### Author: ![DhanushK](https://tradingqna.com/letter_avatar_proxy/v4/letter/d/91b2a8/32.png) [@DhanushK](https://tradingqna.com/u/DhanushK)
#### Post date: [June 9, 2026, 2:30am UTC](https://tradingqna.com/t/introducing-grouping-and-filter-of-positions-on-kite-beta-zerodha-com/188272/37 "2026-06-09T02:30:50Z")

</div>

> [@bharat1080](#):
>
> Please add “DAY” filter on kite web.

> [@DhanushK](#):
>
> It’s WIP. Should be available in a few days; we are revamping a few things wrt filters.

This is now available on the Kite web.

---

<div class="post-metadata">

### Author: ![dtyxg](https://tradingqna.com/letter_avatar_proxy/v4/letter/d/bb73d2/32.png) [@dtyxg](https://tradingqna.com/u/dtyxg)
#### Post date: [June 9, 2026, 2:37am UTC](https://tradingqna.com/t/introducing-grouping-and-filter-of-positions-on-kite-beta-zerodha-com/188272/38 "2026-06-09T02:37:17Z")

</div>

@DhanushK

Could you make the selected filter persistent in mobile version ? I’m using iOS

Whenever I select the filter and close the app and when I open app again it resets to its default state.

---

<div class="post-metadata">

### Author: ![bharat1080](https://tradingqna.com/letter_avatar_proxy/v4/letter/b/85e7bf/32.png) [@bharat1080](https://tradingqna.com/u/bharat1080)
#### Post date: [June 9, 2026, 5:02am UTC](https://tradingqna.com/t/introducing-grouping-and-filter-of-positions-on-kite-beta-zerodha-com/188272/39 "2026-06-09T05:02:29Z")

</div>

> [@DhanushK](#):
>
> This is now available on the Kite web.

Next. Alerts based on P&L.

alerts on whatsapp is possible ?

---

<div class="post-metadata">

### Author: ![mynk](https://tradingqna.com/user_avatar/tradingqna.com/mynk/32/51434_2.png) [@mynk](https://tradingqna.com/u/mynk)
#### Post date: [July 16, 2026, 6:18am UTC](https://tradingqna.com/t/introducing-grouping-and-filter-of-positions-on-kite-beta-zerodha-com/188272/40 "2026-07-16T06:18:28Z")

</div>

Following up on the filter request:

1. Filtering between CE, PE and FUT on kite. Right now they’re all clubbed under NFO. Also
2. In console, under the P&L section, please add **SUBTOTAL** along with additional filters. For eg, if I want to look up what I earned in a particular scrip, I have to manually add up all the trades.  
 ![Screenshot 2026-07-16 at 11.37.39 AM](https://tradingqna.com/uploads/default/original/3X/0/3/03da23f6d61ea05121be0503760fdbaa186881ec.png)  
Same for kite, sum total should be dynamically changed to subtotal upon filtering. (using search filter)

---

<div class="post-metadata">

### Author: ![Piyush\_Modi](https://tradingqna.com/user_avatar/tradingqna.com/piyush_modi/32/63387_2.png) [@Piyush\_Modi](https://tradingqna.com/u/Piyush_Modi)
#### Post date: [August 12, 2026, 2:36pm UTC](https://tradingqna.com/t/introducing-grouping-and-filter-of-positions-on-kite-beta-zerodha-com/188272/41 "2026-08-12T14:36:46Z")

</div>

please introduce a collapse all/expand all button in kite web also just like in kite app.  
if i have too many positions beyond a certain number of lines after grouping it wont show all the positions. have to manually collapse positions then only the last positions will start showing.

Also sorting by p&l & day p&l doesnt work when grouping by underlying is done. ideally it should be sort by each grouping instead it still tries to sort by individual line items instead of by groups.

---

<div class="post-metadata">

### Author: ![dtyxg](https://tradingqna.com/letter_avatar_proxy/v4/letter/d/bb73d2/32.png) [@dtyxg](https://tradingqna.com/u/dtyxg)
#### Post date: [August 12, 2026, 9:26pm UTC](https://tradingqna.com/t/introducing-grouping-and-filter-of-positions-on-kite-beta-zerodha-com/188272/42 "2026-08-12T21:26:15Z")

</div>

I made an extension of my own

Did ask Z many months back, as usual no ETA🥲

Should I dm you the source code of ext ???  
or you can just vibe code it using claude or codex

@Piyush_Modi

---

<div class="post-metadata">

### Author: ![dtyxg](https://tradingqna.com/letter_avatar_proxy/v4/letter/d/bb73d2/32.png) [@dtyxg](https://tradingqna.com/u/dtyxg)
#### Post date: [August 12, 2026, 9:29pm UTC](https://tradingqna.com/t/introducing-grouping-and-filter-of-positions-on-kite-beta-zerodha-com/188272/43 "2026-08-12T21:29:37Z")

</div>

This doesn’t wrk ig

Do dm me if you need it

Made a new version which i use myself; has exp/coll all, max P , auto add position to watchlist etc

Not uploading here because idk Z policy on using ext on Z website

---

<div class="post-metadata">

### Author: ![cvs](https://tradingqna.com/user_avatar/tradingqna.com/cvs/32/92503_2.png) [@cvs](https://tradingqna.com/u/cvs)
#### Post date: [August 13, 2026, 6:15am UTC](https://tradingqna.com/t/introducing-grouping-and-filter-of-positions-on-kite-beta-zerodha-com/188272/44 "2026-08-13T06:15:50Z")

</div>

> [@dtyxg](#):
>
> Not uploading here because idk Z policy on using ext on Z website

@dtyxg IIUC, such community contributions are fine.  
It’s been done on this forum (and outside as well) for several years now.  
_(including what you yourself shared earlier in this thread in Feb)_

**Can someone from [@Zerodha-Staff](https://tradingqna.com/groups/zerodha-staff) promptly chime-in to clarify this doubt?**  
Alongwith typical “do’s” and “don’ts” with such community contributions.  
(eg. permissive license, no financial tall-claims/marketing/promises, no use of Zerodha logo/branding, no claims of being affiliated with Zerodha …)

---

<div class="post-metadata">

### Author: ![Ruchi\_Porwal](https://tradingqna.com/user_avatar/tradingqna.com/ruchi_porwal/32/39956_2.png) [@Ruchi\_Porwal](https://tradingqna.com/u/Ruchi_Porwal)
#### Post date: [August 13, 2026, 6:20am UTC](https://tradingqna.com/t/introducing-grouping-and-filter-of-positions-on-kite-beta-zerodha-com/188272/45 "2026-08-13T06:20:56Z")

</div>

> [@mynk](#):
>
> In console, under the P&L section, please add **SUBTOTAL** along with additional filters. For eg, if I want to look up what I earned in a particular scrip, I have to manually add up all the trades.

Hi @mynk  
This is a known behaviour and will be addressed in a future update.

---

<div class="post-metadata">

### Author: ![Matti](https://tradingqna.com/user_avatar/tradingqna.com/matti/32/1483_2.png) [@Matti](https://tradingqna.com/u/Matti)
#### Post date: [August 13, 2026, 6:34am UTC](https://tradingqna.com/t/introducing-grouping-and-filter-of-positions-on-kite-beta-zerodha-com/188272/46 "2026-08-13T06:34:19Z")

</div>

> [@cvs](#):
>
> **Can someone from [@Zerodha-Staff](https://tradingqna.com/groups/zerodha-staff) promptly chime-in to clarify this doubt?**

Hmmm… No concrete policy per se, but as long as works are genuine, not intended to mislead others in the community, or malicious in any other way, they may be shared here.

@dtyxg your extension sounds completely fine to share here. 🙂

[Previous page](https://tradingqna.com/t/introducing-grouping-and-filter-of-positions-on-kite-beta-zerodha-com/188272.md?page=1)

[Next page](https://tradingqna.com/t/introducing-grouping-and-filter-of-positions-on-kite-beta-zerodha-com/188272.md?page=3)
