Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jqxGrid (React) - with the "bootstrap" theme the buttons in the pager stay focused/pressed #396

Open
jqwidgets opened this issue Feb 11, 2021 · 0 comments

Comments

@jqwidgets
Copy link
Owner

Used this tutorial for a base:
https://www.jqwidgets.com/react-components-documentation/documentation/create-react-app/index.htm

Example:

import React, { Component, useRef } from 'react';
// import { connect } from 'react-redux';

// import logo from './logo.svg';
// import './App.css';

import JqxGrid, { jqx }            from 'jqwidgets-scripts/jqwidgets-react-tsx/jqxgrid';
import JqxButton, { IButtonProps } from 'jqwidgets-scripts/jqwidgets-react-tsx/jqxbuttons';
import 'jqwidgets-scripts/jqwidgets/styles/jqx.base.css';
import 'jqwidgets-scripts/jqwidgets/styles/jqx.bootstrap.css';

export default function App() {
  let isProcessing = false;
  const gridRef = useRef();
  let source = {
    datafields: [
      { name: "id" },
      { name: "first_name" },
      // { name: "last_name" },
      // { name: "email" },
      // { name: "sso_id" }
    ],
    root: "data",
    cache: false,
    datatype: "json",
    url: "https://api.staging.branditpod.com/data_controller_2/?model=DataUser&sortdatafield=first_name&sortorder=asc",
    // localdata: [ {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {} ],
    beforeprocessing: (data) => {
      source.totalrecords = data[0].total_rows;
      console.log("source.totalrecords: " + source.totalrecords);
      console.log(data);
    },
    sort: () => {
      if (!isProcessing) {
        isProcessing = true;
        gridRef.current.updatebounddata("sort");
      }
    },
    filter: () => {
      if (!isProcessing) {
        gridRef.current.updatebounddata("filter");
      }
    }, 
    // clearFilters: () => {
    //   gridRef.clearfilters();
    // }
  };

  let dataAdapter = new jqx.dataAdapter(source);
  const columns = [
    {
      text: "ID",
      datafield: "id",
      type: "number",
      cellsalign: "right",
      width: "5%",
      editable: false
    },
    {
      text: "First Name",
      datafield: "first_name",
      type: "string",
      editable: false
    },
    // {
    //   text: "Last Name",
    //   datafield: "last_name",
    //   type: "string",
    //   editable: false
    // },
    // {
    //   text: "Email",
    //   datafield: "email",
    //   type: "string",
    //   editable: false
    // },
    // {
    //   text: "ECPID",
    //   datafield: "sso_id",
    //   type: "string",
    //   editable: false
    // }
  ];
  
  return (
    <div className="App">
      <div style={{ margin: 20 }}>
        <JqxButton width={80} height={20} theme={"bootstrap"}>Test</JqxButton>
      </div>

      <JqxGrid
        ref={gridRef}
        theme={"bootstrap"}
        width={"100%"}
        columns={columns}
        columnsreorder={true}
        columnsresize={true}
        columnsautoresize={true}
        filterable={true}
        showfilterrow={true}
        autosavestate={true}
        autoloadstate={true}
        autoheight={true}
        pagesizeoptions={["15", "30", "50"]}
        sortable={true}
        pageable={true}
        pagesize={10}
        virtualmode={true}
        rendergridrows={
          function (params) {
          return params.data;
          }
        }
        source={dataAdapter}
        onBindingcomplete = {
          function () {
            isProcessing = false;
          }
        }
      />
    </div>
  );
}
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

No branches or pull requests

1 participant