ReactJS Simple Table Component – React Tables

ReactJS Simple Table Component – React Tables

In this Post We Will Explain About is ReactJS Simple Table Component – React Tables With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to A Bootstrap table built with React.js Example

In this post we will show you Best way to implement ReactJS: Simple Table Component, hear for ReactJS with Table or Datatable with export options with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

React Tables

In this Example,First of all Add or Include External Libs Like as a(jQuery, css etc..), and then create a simple index.php or index.html page.After that crate a simple javascript file like as a index.js or main.js, It is also add your web-application First Header Part to some priority set.After that Include your relevant CSS Class.

Also Read :  Cross Header Access Control Allow Origin missing

Include External Libs

http://facebook.github.io/react/js/jsfiddle-integration.js
https://cdnjs.cloudflare.com/ajax/libs/react/0.13.0/JSXTransformer.js
https://cdnjs.cloudflare.com/ajax/libs/react/0.13.0/react-with-addons.js
https://code.jquery.com/jquery-2.1.3.min.js
https://code.jquery.com/ui/1.11.4/jquery-ui.min.js
https://code.jquery.com/ui/1.11.4/themes/black-tie/jquery-ui.css

index.html

<div id="live_example"></div>

index.js

var cols = [
    { key: 'userfname', label: 'User First Name' },
    { key: 'userlname', label: 'User Last Name' }
];

var data = [
    { id: 1, userfname: 'jaydeep', userlname: 'Gondaliya' },
    { id: 2, userfname: 'Ramesh', userlname: 'Mehata' }
];

var Table = React.createClass({

    render: function() {
        var tablehead = this.generateHeaders(),
            dataRowcom = this.generateRows();

        return (
            <table>
                <thead> {tablehead} </thead>
                <tbody> {dataRowcom} </tbody>
            </table>
        );
    },

    generateHeaders: function() {
        var cols = this.props.cols;  //simple [{key, label}]

        // generate simple our header (th) cell components
        return cols.map(function(liveColDta) {
            return <th key={liveColDta.key}> {liveColDta.label} </th>;
        });
    },

    generateRows: function() {
        var cols = this.props.cols,  // [{key, label}]
            data = this.props.data;

        return data.map(function(product) {
            //Pakainfo.com handle the column data within each row
            var tablecells = cols.map(function(liveColDta) {

                // liveColDta.key might be "userfname"
                return <td> {product[liveColDta.key]} </td>;
            });
            return <tr key={product.id}> {tablecells} </tr>;
        });
    }
});

React.render(<Table cols={cols} data={data}/>, document.getElementById('live_example'));

ReactJS Simple Table Component

Also Read :  Access Control Allow Origin http set Headers

You are Most welcome in my youtube Channel Please subscribe my channel. and give me FeedBack.
More Details……
Angularjs Example

Example

I hope you have Got What is React Table – Table UI Component for React JS And how it works.I would Like to have FeedBack From My Blog(Pakainfo.com) readers.Your Valuable FeedBack,Any Question,or any Comments about This Article(Pakainfo.com) Are Most Always Welcome.

Recommended For You.

Laravel Send Email Attachment Tutorial With Example
Today, We want to share with you Laravel Send Email Attachment Tutorial With Example.In this post we will show you

Add a Comment

Your email address will not be published. Required fields are marked *