Skip to content

feat: klickar man på en data cell så används datan i cellen för att filtrera KaptenAllocEntries#12

Open
lola-cmd wants to merge 1 commit into
mainfrom
lola
Open

feat: klickar man på en data cell så används datan i cellen för att filtrera KaptenAllocEntries#12
lola-cmd wants to merge 1 commit into
mainfrom
lola

Conversation

@lola-cmd
Copy link
Copy Markdown
Collaborator

No description provided.

@eflisback
Copy link
Copy Markdown
Owner

@lola-cmd nice that you're using semantic commit names :)

the data in the cell is used to filter the
displayed KaptenAllocEntries.
Copy link
Copy Markdown
Owner

@eflisback eflisback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One other note: When changing the search query, we want the input element that shows it to be updated. Right now, we're only mapping its output changes to our state value:

input(
  typ := "text",
  placeholder := "Sök...",
  onInput.mapToValue --> searchQuery
),

But if we add one more modifier, like this:

input(
  typ := "text",
  placeholder := "Sök...",
  value <-- searchQuery.signal,
  onInput.mapToValue --> searchQuery
),

it should automatically update the text inside the search field too :)

cursor: pointer;
}

.kapten-alloc-table tbody tr:nth-child(n + 1) span:hover {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this complex CSS selector? Wouldn't it work with just .kapten-alloc-table tbody tr span:hover?

Comment thread src/main/scala/pgkn/pages/KaptenAlloc.scala
searchQuery: Var[String]
): HtmlElement =

def tdFilter(data: String): HtmlElement = {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps consider declaring this function outside the renderTableRow function with the additional parameter searchQuery. I don't know if this applies to Laminar, but for example in React you don't want to declare a component inside another component, as that will lead to the inner component being redeclared each time the outer component re-runs. Do you understand what I mean? Otherwise, very nice.

@lola-cmd lola-cmd requested a review from eflisback November 11, 2025 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants