Git Product home page Git Product logo

selectrowsjs's Introduction

GitHub issues GitHub GitHub tag (latest by date) GitHub last commit

SelectRows.Js

The SelectRows.Js is a JavaScript library for handling the rows selection of an HTML table.

Find a live example here.

>>>> IF YOU LIKE THIS PROJECT, STAR IT ! <<<<

Outline:

  1. Getting Started.
  2. Enabling / Disabling Buttons.
  3. Using SelectRows.Js as a MySaaS Extension.

1. Getting Started

Get started in 3 simple steps.

Step 1. Download the libraries jquery-3.5.1.min.js and selectrows.min.js. You can download them from this page.

Step 2. Include the file of your HTML page.

<script src="jquery-3.5.1.min.js" type="text/javascript"></script>
<script src="./selectrows.min.js" type="text/javascript"></script>

Step 3. Create your table with rows selection.

Example:

<table class="table table-striped" style='table-layout: fixed; width: 100%;'>
    <thead>
        <th style='text-align: center; width:15px' >
            <input class="checkbox select-all-rows" data-input-id='ids' data-rows-group-id='users' type="checkbox">
        </th>
        <th style ='width:auto;'>
            Name
        </th>
        ...
    </thead>
        
    <tbody>
        <input type='hidden' name='ids' id='ids' value='' />
        <tr>
            <td style='text-align: center; vertical-align: top;'>
                <input class="checkbox select-row" data-rows-group-id='users' type="checkbox" id="123" data-id="123" />
            </td>
            <td>
                <input class='user-input input-block-level' type='text' id='name' value='Leandro Daniel Sardi' />
            </td>
            ...
        </tr>
    </tbody>
</table>

<script>
    // call the function init when the page is loaded.
    selectRowsJs.init();
</script>

2. Enabling / Disabling Buttons

Some buttons in your screen may require one or more rows are selected.

Add the tag data-rows-group-id='users' on the buttons and checkboxes, in order to link all of them together.

E.g.:

<table class="table table-striped">
    <thead>
        <th style='text-align: center; width:15px' >
            <input class="checkbox select-all-rows" data-input-id='ids' data-rows-group-id='users' type="checkbox">
        </th>
        ...
    <tbody>
        <tr>
            <td style='text-align: center; vertical-align: top;'>
                <input class="checkbox select-row" data-rows-group-id='users' type="checkbox" id="123" data-id="123" />
            </td>
            ...

3. Using SelectRows.Js as a MySaaS Extension

If you are running a MySaaS project, you can add SelectRows.js as an extension.

Such an extension includes a code example screen (/selectrowsjs) that you show to other developers, for reference.

Install SelectRows.js as an extension of MySaaS is pretty simple.

Step 1: Clone the project in the extensions filder.

cd ~/code/mysaas/extensions
git clone https://github.com/leandrosardi/selectrowsjs

Step 2: Add the extension to your config.rb file.

BlackStack::Extensions.append :selectrowsjs

selectrowsjs's People

Contributors

leandrosardi avatar

Stargazers

 avatar

Watchers

 avatar  avatar

selectrowsjs's Issues

Use selectrowsjs as a MySaaS extension.

  1. Add the app.rb file.
  2. Setup extension.rb to add a link to /developers/selectrowsjs/example.html in the footer of MySaaS, in the section Developers.
  3. Setup extension.rb to call the file selectrows.min.js when load a page of MySaaS.
  4. Remove the source code of SelectRows.Js from the screen /settings/users.
    This code: https://github.com/leandrosardi/mysaas/blob/0.0.3/views/settings/users.erb#L276
  5. Add the extension in the config.rb of your MySaaS project, and test it in the /settings/users screen.
  6. Add a new section 2. Using SelectRows.Js as a [MySaaS](https://github.com/leandrosardi/mysaas) Extension in the README.md file of the selectrowsjs project. There, explain how to add filters.js as an extension of MySaaS.
    Here is a good example that you can follow: https://github.com/leandrosardi/leads#1-getting-started.

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.