How to use the react-virtualized.SortDirection.DESC function in react-virtualized

To help you get started, we’ve selected a few react-virtualized examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github studentinsights / studentinsights / app / assets / javascripts / my_sections / MySectionsPage.js View on Github external
orderedSections(sections) {
    const {sortBy, sortDirection} = this.state;

    // map dataKey to an accessor/sort function
    const sortFns = {
      fallback(section) { return section[sortBy]; }
      // grade(section) { return rankedByGradeLevel(section.grade); },
      // school(section) { return section.school.name; },
      // name(section) { return `${section.last_name}, ${section.first_name}`; }
    };
    const sortFn = sortFns[sortBy] || sortFns.fallback;
    const sortedRows = _.sortBy(sections, sortFn);

    // respect direction
    return (sortDirection == SortDirection.DESC) 
      ? sortedRows.reverse()
      : sortedRows;
  }
github studentinsights / studentinsights / app / assets / javascripts / transitions / TransitionsPage.js View on Github external
const sortFns = {
      fallback(student) { return student[sortBy]; },
      
      name(student) { return `${student.last_name}, ${student.first_name}`; },
      school(student) { return shortSchoolName(districtKey, student.school.local_id); },
      grade(student) { return rankedByGradeLevel(student.grade); },
      counselor(student) { return maybeCapitalize(student.counselor); },
      note(student) { return hasNote(student); } ,
      starred(student) { return isStarred(student); }
    };
    const sortFn = sortFns[sortBy] || sortFns.fallback;
    const studentsByName = _.sortBy(students, sortFns.name);
    const sortedRows = _.sortBy(studentsByName, sortFn);

    // respect direction
    return (sortDirection == SortDirection.DESC) 
      ? sortedRows.reverse()
      : sortedRows;
  }
github studentinsights / studentinsights / app / assets / javascripts / school_administrator_dashboard / dashboard_components / StudentsTable.js View on Github external
{this.renderCaption()}
          
        
         list[index]}
          headerHeight={25}
          headerStyle={{display: 'flex', marginRight: 5}}
          rowHeight={25}
          style={{fontSize: 14}}
          rowStyle={this.renderRowStyle}
          sort={this.onTableSort}
          sortBy={sortBy}
          sortDirection={sortDesc ? SortDirection.DESC : SortDirection.ASC}
        >
           fullName(rowData)}
            cellRenderer={this.renderStudent}
            width={200}
            flexGrow={1}
          />
          
          <table height="{400}" width="{400}"></table>
github deskfiler / deskfiler / src / main-renderer / containers / Logs / Logs.jsx View on Github external
useEffect(() => {
    setSortDirection(SortDirection.DESC);
  }, [plugins, sideView]);
github airbnb / lunar / packages / core / src / components / DataTable / ColumnLabels.tsx View on Github external
columnMetadata &amp;&amp; columnMetadata[key] &amp;&amp; columnMetadata[key].rightAlign
                  ? rightAlignmentStyle
                  : {}
              }
              className={cx(styles &amp;&amp; styles.headerRow)}
            &gt;
              

              {label &amp;&amp; sortable &amp;&amp; (
                
                  
                
              )}
            
          
        
      );

      return React.cloneElement(col, col.props, newHeader);
    });
github nteract / nteract / packages / transform-dataresource / src / virtualized-table.js View on Github external
sort = ({ sortBy, sortDirection }: State) => {
    const data = _sortBy(this.props.data, [sortBy]);
    this.state.data =
      sortDirection === SortDirection.DESC ? data.reverse() : data;
    this.setState({ sortBy, sortDirection });
  };
github studentinsights / studentinsights / app / assets / javascripts / my_sections / MySectionsPage.js View on Github external
onTableSort({defaultSortDirection, event, sortBy, sortDirection}) {
    if (sortBy === this.state.sortBy) {
      const oppositeSortDirection = (this.state.sortDirection == SortDirection.DESC)
        ? SortDirection.ASC
        : SortDirection.DESC;
      this.setState({ sortDirection: oppositeSortDirection });
    } else {
      this.setState({sortBy});
    }
  }
github chanzuckerberg / idseq-web / app / assets / src / components / views / bulk_download / BulkDownloadList.jsx View on Github external
This page is no longer auto-updating.{" "}
              <span>
                Click here to see additional updates.
              </span>
            
          )}
        
    );
  }
<table>
      </table>
github studentinsights / studentinsights / app / assets / javascripts / my_sections / MySectionsPage.js View on Github external
onTableSort({defaultSortDirection, event, sortBy, sortDirection}) {
    if (sortBy === this.state.sortBy) {
      const oppositeSortDirection = (this.state.sortDirection == SortDirection.DESC)
        ? SortDirection.ASC
        : SortDirection.DESC;
      this.setState({ sortDirection: oppositeSortDirection });
    } else {
      this.setState({sortBy});
    }
  }
github MCS-Lite / mcs-lite / packages / mcs-lite-admin-web / src / containers / User / Table.js View on Github external
sortWithState = ({ sortBy, sortDirection }) => {
    const lens = R.prop(sortBy);

    return R.sortWith([
      sortDirection === SortDirection.DESC ? R.descend(lens) : R.ascend(lens),
    ]);
  };