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

Best approach to have actions column with buttons. When hit to open a modal outside Griddle. #621

Open
christopher-rain opened this issue Mar 23, 2017 · 1 comment
Labels

Comments

@christopher-rain
Copy link

Hi,

I'm trying to have an Actions column with Edit and View buttons. I am using a customComponent.

const GriddleActionColumn = ({value}) => {
    return (
        <span>
            <a onClick={} className="btn btn-sm btn-outline blue-madison"><i className="fa fa-edit"></i> Edit </a>
            <a href={value} className="btn btn-sm btn-outline blue-madison"><i className="fa fa-search"></i> View </a>
        </span>
    );
}

I need to somehow grab the onClick event and open a Modal.

I also tried making this component connected to my Redux store.

import React from 'react';
import {connect} from 'react-redux';
import { editAccount } from '../actions';

class ListActions extends React.Component {
    render() {
        const { value } = this.props;

        return (
            <span>
                <a onClick={ () => { this.props.editAccount({value); } } className="btn btn-sm btn-outline blue-madison"><i className="fa fa-edit"></i> Edit </a>
            </span>
        );
    }
}

export default connect(null, { editAccount } )(ListActions);

but i got an error when clicking the Edit button:
Uncaught TypeError: Cannot read property 'map' of undefined dataSelectors.js:246

/** Gets the griddleIds for the visible rows */
var visibleRowIdsSelector = exports.visibleRowIdsSelector = (0, _reselect.createSelector)(dataSelector, function (currentPageData) {
  return currentPageData.map(function (c) {
    return c.get('griddleKey');
  });
});

at return currentPageData.map(function (c) {

Any idea what is the best approach to get the onClick event in the button? Again my goal is to have actions col with actions buttons. When clicking Edit I want to communicate outside Griddle and show a popup.

Thanks.

@sww314
Copy link

sww314 commented Jul 16, 2017

Also related: #680

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants