Giter Club home page Giter Club logo

react-pagination's Introduction

React-pagination

Issue Stats Issue Stats

A high render quality pagination component base on React.js

JS Interface

If JSX

React.render(
	<Pagination
		url="/api/getproduct"
		data={
			{
				index : 1,
				size : 10,
				data : {
					name : "page"
				}
			}
		}
		index="1"
		size="10"
		supertype=""
		type=""
		status=""
		callback={
			function(componentState){
				React.render(
					<Product data={componentState.data} />,
					document.querySelector(".products")
				);
			}
		}
	/>,
	document.querySelector("#pagination")
);

If JS

React.render(
	React.createElement(Pagination, {
		url : "/api/getproduct",
		data : {
			index : 1,
			total : 10,
			data : {
				name : "page"
			}
		},
		index : "1",
		size : "10",
		supertype : "",
		type : "",
		status : "",
		callback : function(componentState){
			React.render(
				React.createElement(Product, {data: componentState.data}),
				document.querySelector(".products")
			);
		}
	}),
	document.querySelector("#pagination")
);

Server Interface

If NodeJS

app.get("/api/getproduct", function(req, res){
	res.json({
		index : parseInt(req.query.index) || 1,
		size : parseInt(req.query.size) || 10,
		total : 10,
		data : {
			name : "page" + (parseInt(req.query.index) || 1)
		}
	});
});

Notice

  • Arguments in the interface like supertype, type and status can be changed into any other arguments which the server side need.
    1. If you wanna initialize this component and make a request to get data from server side the same time, make sure you write down the url in the interface.
    2. If you've got data outer this component and just wanna send the data into it, make sure you write both the url and the data down in the interface so that it will not send a request the first time you initialize it and send the requests only on your click events.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.