feat(filter-table-all-next): initial commit
This commit is contained in:
parent
333589accb
commit
fa9743554b
|
@ -0,0 +1,108 @@
|
|||
# Others
|
||||
package-lock.json
|
||||
build*
|
||||
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
*.lcov
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# TypeScript v1 declaration files
|
||||
typings/
|
||||
|
||||
# TypeScript cache
|
||||
*.tsbuildinfo
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Microbundle cache
|
||||
.rpt2_cache/
|
||||
.rts2_cache_cjs/
|
||||
.rts2_cache_es/
|
||||
.rts2_cache_umd/
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variables file
|
||||
.env
|
||||
.env.test
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
|
||||
# Next.js build output
|
||||
.next
|
||||
|
||||
# Nuxt.js build / generate output
|
||||
.nuxt
|
||||
dist
|
||||
|
||||
# Gatsby files
|
||||
.cache/
|
||||
# Comment in the public line in if your project uses Gatsby and *not* Next.js
|
||||
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||
# public
|
||||
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
|
||||
# Serverless directories
|
||||
.serverless/
|
||||
|
||||
# FuseBox cache
|
||||
.fusebox/
|
||||
|
||||
# DynamoDB Local files
|
||||
.dynamodb/
|
||||
|
||||
# TernJS port file
|
||||
.tern-port
|
|
@ -0,0 +1,12 @@
|
|||
# webpack-js
|
||||
|
||||
## Table of Contents
|
||||
0. [General](#general)
|
||||
1. [Links](#links)
|
||||
|
||||
# General
|
||||
|
||||
# Links
|
||||
|
||||
* [React setup with webpack for beginners](https://dev.to/deepanjangh/react-setup-with-webpack-for-beginners-2a8k)
|
||||
* [JavaScript Table Filter or Search | Add Filter In HTML CSS Table](https://webdevtrick.com/javascript-table-filter/)
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"private": true,
|
||||
"name": "webpack-js",
|
||||
"description": "example using webpack for vanilla JavaScript",
|
||||
"version": "0.0.1",
|
||||
"main": "index.js",
|
||||
"keywords": [
|
||||
"react",
|
||||
"webpack"
|
||||
],
|
||||
"author": "Software Ingenieur Begerad <dialog@SwIngBe.de>",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "webpack serve --config ./webpack.config.js --mode development"
|
||||
},
|
||||
"devDependencies": {
|
||||
"webpack": "^5.73.0",
|
||||
"webpack-cli": "^4.9.2",
|
||||
"webpack-dev-server": "^4.9.2"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,125 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>React with webpack</title>
|
||||
</head>
|
||||
<body>
|
||||
<section class="container">
|
||||
|
||||
<h1>Table Filter JavaScript</h2>
|
||||
|
||||
<input type="search" class="light-table-filter" data-table="table-info" placeholder="Filter/Search">
|
||||
|
||||
<table class="table-info table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Email</th>
|
||||
<th>Phone No</th>
|
||||
<th>ID</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>John Doe</td>
|
||||
<td>john.doe@gmail.com</td>
|
||||
<td>0123456789</td>
|
||||
<td>01</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Alen Fox</td>
|
||||
<td>Alen.fox@gmail.com</td>
|
||||
<td>0155456789</td>
|
||||
<td>02</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Rakesh Sharma</td>
|
||||
<td>rakesh.sharma@gmail.com</td>
|
||||
<td>6754328901</td>
|
||||
<td>03</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Bunty Singh</td>
|
||||
<td>Bunty.singh@gmail.com</td>
|
||||
<td>5678241598</td>
|
||||
<td>04</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Sushant Rajput</td>
|
||||
<td>sushant.rajput@gmail.com</td>
|
||||
<td>675457801</td>
|
||||
<td>05</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Sunny Sharma</td>
|
||||
<td>sunnysharma@gmail.com</td>
|
||||
<td>675123451</td>
|
||||
<td>06</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Saurav Gupta</td>
|
||||
<td>saurav.gupta@gmail.com</td>
|
||||
<td>61234801</td>
|
||||
<td>07</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Appu Khote</td>
|
||||
<td>appu.khote@gmail.com</td>
|
||||
<td>67894561</td>
|
||||
<td>08</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Sandeep Arya</td>
|
||||
<td>sandeep.arya@gmail.com</td>
|
||||
<td>741852963</td>
|
||||
<td>09</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Vijay Mehra</td>
|
||||
<td>vijay.mehra@gmail.com</td>
|
||||
<td>456851982</td>
|
||||
<td>10</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</section>
|
||||
|
||||
<script>
|
||||
(function(document) {
|
||||
'use strict';
|
||||
var TableFilter = (function(Arr) {
|
||||
var _input;
|
||||
function _onInputEvent(e) {
|
||||
_input = e.target;
|
||||
var tables = document.getElementsByClassName(_input.getAttribute('data-table'));
|
||||
Arr.forEach.call(tables, function(table) {
|
||||
Arr.forEach.call(table.tBodies, function(tbody) {
|
||||
Arr.forEach.call(tbody.rows, _filter);
|
||||
});
|
||||
});
|
||||
}
|
||||
function _filter(row) {
|
||||
var text = row.textContent.toLowerCase(), val = _input.value.toLowerCase();
|
||||
row.style.display = text.indexOf(val) === -1 ? 'none' : 'table-row';
|
||||
}
|
||||
return {
|
||||
init: function() {
|
||||
var inputs = document.getElementsByClassName('light-table-filter');
|
||||
Arr.forEach.call(inputs, function(input) {
|
||||
input.oninput = _onInputEvent;
|
||||
});
|
||||
}
|
||||
};
|
||||
})(Array.prototype);
|
||||
document.addEventListener('readystatechange', function() {
|
||||
if (document.readyState === 'complete') {
|
||||
TableFilter.init();
|
||||
}
|
||||
});
|
||||
})(document);
|
||||
</script>
|
||||
<script src="./bundle.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1 @@
|
|||
console.log("Hello World")
|
|
@ -0,0 +1,12 @@
|
|||
//path is used to resolve properly across the OS
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
//bundle *.js from this entry point
|
||||
entry: path.resolve(__dirname, './src/index.js'),
|
||||
//create output file to be linked to index.html
|
||||
output: {
|
||||
path: path.resolve(__dirname, './public'),
|
||||
filename: 'bundle.js',
|
||||
},
|
||||
};
|
Loading…
Reference in New Issue