Skip to content

Commit

Permalink
fix isFilterActive for splitText
Browse files Browse the repository at this point in the history
  • Loading branch information
olmobrutall committed Feb 16, 2021
1 parent 365f82b commit efbe320
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Signum.React/Scripts/SearchControl/FilterBuilder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,13 @@ export function FilterGroupComponent(p: FilterGroupComponentsProps) {
}

function isFilterActive(fo: FilterOptionParsed) {
return fo.pinned == null ||
fo.pinned.active == null /*Always*/ ||
if (fo.pinned == null)
return true;

if (fo.pinned.splitText && (fo.value == null || fo.value == ""))
return false;

return fo.pinned.active == null /*Always*/ ||
fo.pinned.active == "Always" ||
fo.pinned.active == "Checkbox_StartChecked" ||
fo.pinned.active == "WhenHasValue" && !(fo.value == null || fo.value == "");
Expand Down

4 comments on commit efbe320

@olmobrutall
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Improvements in SearchControl and UserQueries

Here are some improvements in SearchControl that I've made in the last weeks:

  • Simplified Pinned Filters
  • Summary headers
  • Operations on groups
  • Open group with a User query

Let's see the details:

Simplified Pinned Filters

Pinned Filters where presented more than two years ago.

While they are successful in making the simpler case simpler (by hiding the query tokens for the common use cases of a query):
image

They also made the complex case more complex (by adding a lot of PinnedFilter-related options to what before where just a table of Field, Operation and Value):
image

This experience is quite overwhelming for a newbie, so I tried a few ways to reduce the complexity, like collapsing the OR/AND groups by default, or changing the opacity to the filters that are inactive, but the UX wasn't quite right.

This changes adds a new Show / hide pinned filter options that by default:

  • Hides all the inactive pinned filters
  • Hides all the pinned-filter related options.

This way when the user switches to the complex filters has just sees a simple Filter, Operation, Value table with only the filters that are currently active.

image

The Pinned filter configuration can be shown if necessary but is mostly only interesting when configuring a user query anyway.

Summary headers

The SearchControl's column options got a new interesting feature: being able to add an aggregate for the whole table on the header itself.

The typical cases is to show the total sum of a particular value, but in can be any aggregate (Avg, Min, Max, Count, Count Null, Count not Null, Count a particular value).

image

This aggregate is affected by the filters in the query, but not by the pagination (implicit All).

It's also works, but is not affected by, queries with groupings:

image

Using Summary headers means doing an extra SQL to the database, so it could be slower for very big tables.

Operations on groups

This is an older feature but maybe not known because is not activated by default.

If you have a SearchControl with grouping activated and you open the contextual menu on one or more selected groups you typically only get a simple "Add Filter" option for the current cell.

This is because by default running operations on groups could be dangerous, but you can activate it by setting showContextMenu on the QuerySettings:

 Finder.addSettings({
    queryName: OrderEntity,
    showContextMenu: fop => true,
});

image

The effect on the server side is the same as if the user would have drill-down on the group and selected all the elements, that is, all the Lites in the selected group(s) are resolved in the client-side and sent to the server-side.

Open group with a User query

Finally, and this is a new feature, you can now drill-down in groups using another UserQuery as the template by selecting it in the ContextMenu. Let's see an example:

Imagine that you have a user query Orders by customer that shows the orders in a particular interesting format (in this case, grouped by customer).
image

By selecting in Append filters we are saying that this user query, when selected, can concatenate his filters to the current SearchControl filters. Till now this was an exotic and not that useful feature, but now this makes the user query eligible when using the context menu on a group.

In our example, if we have a SearchControl grouping Orders by State (maybe a UserQuery, but is not necessary) then when we right-click on one group we can see out user query as an option:

image

And when we click we can see the 21 Orders in state Ordered grouped by Customer

image

Note that the UserQuery now support Summary headers too.

Also, just as with group operations, being able select this option depends on overriding showContextMenu on the QuerySettings.

Conclusion

I hope all this changes give you some ideas of new possible UX patterns, so you can make your users happier and more productive using the SearchControl.

@JafarMirzaie
Copy link
Contributor

@JafarMirzaie JafarMirzaie commented on efbe320 Feb 17, 2021 via email

Choose a reason for hiding this comment

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

@doganc
Copy link

@doganc doganc commented on efbe320 Feb 17, 2021

Choose a reason for hiding this comment

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

Perfect,
especially Summary Headers very useful for users,

@MehdyKarimpour
Copy link
Contributor

@MehdyKarimpour MehdyKarimpour commented on efbe320 Feb 17, 2021 via email

Choose a reason for hiding this comment

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

Please sign in to comment.