Giter Club home page Giter Club logo

Comments (19)

melloware avatar melloware commented on July 24, 2024 1

PR submitted.

from primereact.

ssode avatar ssode commented on July 24, 2024 1

@melloware awesome, thank you!

from primereact.

melloware avatar melloware commented on July 24, 2024

First your StackBlitz is a mess. Here is how to properly do a locale to Arabic.

https://stackblitz.com/edit/pt46mo?file=src%2Fmain.tsx

You didn't follow the PrimeTek instructions https://primereact.org/configuration/#Locale

from primereact.

melloware avatar melloware commented on July 24, 2024

Second how do I get your filter.trim issue its not happening for me? Your stackblitz doesn't even have a multi-select filter in it?

from primereact.

melloware avatar melloware commented on July 24, 2024

Here is a working Multiselect Filter in Arabic: https://stackblitz.com/edit/zwnmig?file=src%2Fmain.jsx,src%2FApp.jsx

Just change the Agent column you will see its all working...

from primereact.

github-actions avatar github-actions commented on July 24, 2024

We're unable to replicate your issue, if you are able to create a reproducer or add details please edit this issue. This issue will be closed if no activities in 20 days.

from primereact.

fullstackomar avatar fullstackomar commented on July 24, 2024

image

image

I am using next.js , maybe its because next.js has the issue , its working on vite but not in next.js not sure why

will try to make an example and upload it here with next js

from primereact.

melloware avatar melloware commented on July 24, 2024

Nope look at my example it works fine it won't matter next.js or vite you have a bug in your code...

Make sure you have representative: { value: null, matchMode: FilterMatchMode.IN }, correct? as FilterMatchMode.IN for the type of multi-select filter?

from primereact.

fullstackomar avatar fullstackomar commented on July 24, 2024

will try to debug and tell the results

from primereact.

fullstackomar avatar fullstackomar commented on July 24, 2024

I found the issue , the issue that I must add filterMatchMode="in" to the column but there is a typescript issue when I did that

No overload matches this call.
  Overload 1 of 2, '(props: ColumnProps | Readonly<ColumnProps>): Column', gave the following error.
    Type '"in"' is not assignable to type 'FilterMatchMode | undefined'.
  Overload 2 of 2, '(props: ColumnProps, context: any): Column', gave the following error.
    Type '"in"' is not assignable to type 'FilterMatchMode | undefined'.ts(2769)
column.d.ts(967, 5): The expected type comes from property 'filterMatchMode' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<Column> & Readonly<ColumnProps>'
column.d.ts(967, 5): The expected type comes from property 'filterMatchMode' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<Column> & Readonly<ColumnProps>'
(property) filterMatchMode?: FilterMatchMode | undefined
Defines filterMatchMode; "startsWith", "contains", "endsWith", "equals", "notEquals", "in", "lt", "lte", "gt", "gte" and "custom".

from primereact.

melloware avatar melloware commented on July 24, 2024

@fullstackomar here is a TypeScript version it works fine with in...

https://stackblitz.com/edit/ewtchr?file=src%2FApp.tsx

from primereact.

fullstackomar avatar fullstackomar commented on July 24, 2024

thank you melloware , I was using it inside the Column but I think there is a typescript that needs to be changed inside the column files i used @ts-ignore for now but I think it should be added into the next update

<Column field="city" header="المنطقة" filter filterElement={dropDownTemplate(cities.map((c) => c.value),"choose city")} showFilterOperator={false} showFilterMatchModes={false} filterMatchMode="in" showAddButton={false} style={{ minWidth: "120px" }} />

from primereact.

fullstackomar avatar fullstackomar commented on July 24, 2024

I added an extra string to the filterMatchMode inside column and the problem is fixed but please if u can add it to the next patch it would be amazing :)

filterMatchMode?: FilterMatchMode | undefined | string;

from primereact.

ssode avatar ssode commented on July 24, 2024

Hey all, the change that was made to the type for filterMatchModeOptions seems to have broken the match mode dropdown when supplying custom options as it was relying on the property name being value.

https://stackblitz.com/edit/ko42te?file=src%2FApp.jsx

from primereact.

melloware avatar melloware commented on July 24, 2024

@ssode your stackblitz is not even typescript? these changes were only to Typescript defs.

from primereact.

ssode avatar ssode commented on July 24, 2024

https://stackblitz.com/edit/wwhfur?file=src%2FApp.tsx

from primereact.

melloware avatar melloware commented on July 24, 2024

@ssode i am still not seeing any compiler Typescript complaining? What exactly is your issue?

from primereact.

ssode avatar ssode commented on July 24, 2024

@melloware The issue is that the change to the type for filterMatchModeOptions is breaking the match mode dropdown in the filter menu (for me at least). The option isn't getting selected by default and when you do click on it and try to filter it doesn't return any results.

It looks like internally the matchMode on the filter object is being set to the entire object from filterMatchModeOptions:

image

Since the key was changed from value to matchMode the dropdown isn't handling it correctly, I think either the optionValue prop needs to be set on the Dropdown that gets created to specify the new key or the options need to be mapped back to a { label, value } object here.

const matchModes = () => {
return (
getColumnProp('filterMatchModeOptions') ||
(context && context.filterMatchModeOptions[findDataType()].map((key) => ({ label: localeOption(key), value: key }))) ||
PrimeReact.filterMatchModeOptions[findDataType()].map((key) => ({ label: localeOption(key), value: key }))
);
};

from primereact.

melloware avatar melloware commented on July 24, 2024

@ssode my bad PR submitted: #6314

was a cut and paste mistake.

from primereact.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.