Telerik Forums
KendoReact Forum
2 answers
21 views
Hello.

I am trying to use your react grid with data passed in as props with filtering and sorting. I am following this article as a guide - https://www.telerik.com/blogs/sorting-filtering-grouping-kendoreact-data-grid. My issue is that when I pass the data in via props, it does not initially appear. If I actually try filtering, the data will show up. My issue is here -

 const [resultState, setResultState] = React.useState(
   process(props.gridData, initialDataState)
 );

This does not seem to work on the initial rendering of the component. Again, when I start filtering, everything shows up properly. I have read that using props to set an initial state is considered an anti-pattern. Thus, I know something is off here.

Almost all of your examples use data from a json file. However, I have retrieved my data from a rest endpoint and I'm passing it in to my grid component via props.

If I simply use the grid without filtering and sorting with the data passed in as props, everything works fine. However, I would like to use your filtering and sorting capabilities.

Please help

Thanks
Sunil
Top achievements
Rank 1
Iron
 answered on 07 Feb 2024
1 answer
31 views
I have a GridColumnMenuCheckboxFilter and GridColumnMenuSort for pricing filter showing different value and label based on currency format..
filtering is working fine but sort is not working as expected for example if i filter one price column and sort beside column data is getting empty.

pls refer the following example thank u

https://stackblitz.com/edit/react-sjotkk-zudywu?file=app%2FcolumnMenu.jsx
Vessy
Telerik team
 answered on 17 Nov 2023
1 answer
404 views

Hi,

Is it possible to apply custom sort logic to a Data Grid Column which is applied when clicking on the Column header? As an example, we have a Date column with nullable values. We would like nulls to be considered highest i.e.

  • ascending: lowest date value -> highest date value -> null date values
  • descending: null date values -> highest date value -> lowest date value

In the default sort nulls are considered lowest.

Konstantin Dikov
Telerik team
 answered on 04 May 2023
2 answers
83 views

Hi, In my application I have a sorting by both Column header click and by column menu. React

I am able to sort multiple columns only by column header click. Events triggerred in these headers click properly maintains their sort state variable, preserving the whole previous user inputs

But at the same time, I am not able to sort multi columns via column menu option. The event.sort for these events trigger only the current sort applied but not maintaining the previous inputs of it... The Grid refreshes everytime the new column menu input sort is provided 

 

So, I need maintain a state combining both the sorting forms.

Any solutions to have a common state or to prevent the tefresh ?

And one more add on, I have given sortable.mode = multiple and sortable.allowUnsort = true.... How do we get to know the field name when unsort is applied, the event.sort simply returns an array and no info on the field name

Wissam
Telerik team
 answered on 20 Apr 2023
1 answer
156 views
i want 50% opacity k-icon ascending order icon while sort is none. I tried to do soo with css, but tag doesn't exist on none order. Is there any way to achieve this in kendo react ? 
Konstantin Dikov
Telerik team
 answered on 30 Dec 2022
1 answer
174 views

Hi,

I am trying to implement a custom pager which I am able to implement on the lines of your given in your documentation https://www.telerik.com/kendo-react-ui/components/grid/paging/. Please refer to Custom Pager section.

However when I make the grid sortable, the sort icons (up and down arrows) do not appear in the column header. Please look  at the link  https://stackblitz.com/edit/react-7fthgv-hcysax?file=app%2Fmain.tsx which demonstrates the problem. I have set the property sortable to true here both for the Grid and the GridColumn.

I am not sure why the sort icons are not appearing. 

I am using kendo data grid version 5.9.0. If you need any other info please let me know. Any help would be appreciated.

Thanks

Janaki

Konstantin Dikov
Telerik team
 answered on 28 Dec 2022
1 answer
64 views
i found many example using compare function in sortable options in js or jquery kendo grid. How can i achieve thing using kendo react grid ?
Konstantin Dikov
Telerik team
 answered on 26 Dec 2022
2 answers
1.2K+ views

Hello,

I am trying to sort the date with sort feature inside the grid. But looks like it's not sorting for me based on the time also it's taking as a string.

If you let me how to perform sort on date column then that would be great!

I have added the screenshot and code snippet for the reference


const generateDate = () => {
  const currDate = new Date();
  const formatDateUS = currDate.toLocaleDateString("en-US");
  console.log(formatDateUS);
  return formatDateUS;
};


Sachin
Top achievements
Rank 1
Iron
Iron
 answered on 07 Nov 2022
2 answers
261 views

I was working on sort feature exactly similar to the link below, but when I click on the sort on the grid row for the 3rd time(default sort), it's not sorting as well as it won't show the up or down arrow. Is that's how the sort is implemented? I don't see sorted either in the example for default productName(code sandbox  link).

What if I need only two time feature that is default "asc" and "des" ONLY?

Kindly let me know what's going on.

As you see in the screenshot I am not able to get "2 Test" at the 3rd time of sort

 https://codesandbox.io/s/muddy-shape-dzdfwi
const initialSort = [
  {
    field: "displayname",
    dir: "asc",
  },
];

const CustomerAccountPage = () => {
  // for sorting
  const [sort, setSort] = useState(initialSort);

  // console.log(data)
  return (
    <>
      <NewCustomerForm updateData={updateData} />
      {data && (
        <div>
          <div className="font-bold pt-6 pl-20">
            <h4>Accounts</h4>
          </div>
          <div className="pt-4 pl-20">
            <Grid
              style={{
                height: "600px",
                border: 0
              }}
              data={orderBy(data?.getAccounts ?? [], sort)}
              sortable={true}
              sort={sort}
              onSortChange={(e) => {
                setSort(e.sort);
              }}
            >
              <GridColumn
                field="displayname"
                title="Customer"
                width="250px"
                // cell={MyEditCommandCell}
              />
              <GridColumn
                field="customerId"
                title="Customer ID"
                width="250px"
              />
              <GridColumn
                field="createdAt"
                title="Date Created"
                width="200px"
              />
              <GridColumn field="region" title="Country/Region" width="350px" />
              <GridColumn field="apps" title="Apps" width="200px" />
              <GridColumn field="vpn" title="VPN" width="200px" />
              <GridColumn
                title="Action"
                width="100px"
                cell={MyEditCommandCell}
              />
            </Grid>
            {openForm && (
              <EditCustomerAccount
                cancelEdit={handleCancelEdit}
                onSubmit={handleSubmit}
                item={editItem}
                visible={openForm}
              />
            )}
          </div>
        </div>
      )}
    </>
  );
};

export default CustomerAccountPage;

Sachin
Top achievements
Rank 1
Iron
Iron
 answered on 01 Nov 2022
1 answer
63 views
Hello, I need a data grid with external form editing, sorting, grouping and filtering functions.
Please, do you have a template for such solution?
Konstantin Dikov
Telerik team
 answered on 10 Oct 2022
Narrow your results
Selected tags
Tags
+? more
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?