Get value of cells on button clicked on Jquery Datatables

I have used JQuery Datatable to display the info below and I'm new to this plugin:

I have used JQuery Datatable to display the info below and I'm new to this plugin:

Jquery DataTable

On field "WifiCode" I'm using "render" to display a button.

I need that when the button is clicked, to get the values or a specific column value in that row.

How can i do that ?

<script>
    $(document).ready(function () {
        var table = $('#visitorsTable').DataTable({              
            "ajax": {
                "url": "Home/LoadData",
                "type": "GET",
                "datatype": "json",
            },
            "columns": [                   
                { "data": "FirstName" },
                { "data": "LastName" },                   
                { "data": "PlateNumber" },
                {
                    "data": "WifiCode", 
                    "render": function(wifiCode) {
                       if (wifiCode) {                              
                           return '<span> ' + wifiCode + '</span><button data-visitor-wifi="'+ wifiCode +'" id="btnResend"></button>';
                       }                           
                   }
                },                   
            ]
        });
    });
</script>


jQuery Full Course - jQuery Tutorial From Beginner to Advanced - Learn jQuery 2019

jQuery is a cross-platform JavaScript library designed to simplify the client-side scripting of HTML. In this video, you'll learn jQuery from Beginner to Advanced

jQuery is open-source software using the permissive MIT License. Web analysis indicates that it is the most widely deployed JavaScript library by a large margin.

Mastering jQuery will boost up your career specially in web development. This course is designed you to master yourself in jQuery through step by step process.

Course Contents

  • jQuery Intro
  • What is jQuery and what you will learn?
  • Downloading jQuery
  • jQuery Basics
  • A first look at jQuery code
  • Selectors and Filters
  • Replacing contents
  • Handling events
  • Hide/Show events
  • Fading
  • Slide
  • Toggle
  • Animate
  • Selectors
  • Filters
  • jQuery Advanced
  • Advanced Selectors
  • Creating Content
  • Creating Content: Part 2
  • Inserting content
  • Modifying content
  • Modifying CSS
  • Final thoughts


What you’ll learn

  • Will become Master in client side web development
  • Will become expert in jQuery
  • Will earn working experience on jQuery
  • Are there any course requirements or prerequisites?
  • Prior experience on HTML and CSS required.
  • Who this course is for:
  • Who wanna expert in client side web development
  • Who wanna expert in jQuery


Thanks for watching

If you liked this post, share it with all of your programming buddies!

Follow us on Facebook | Twitter

Should use CSS, jQuery or React to Filtering Data Client-Side

Should use CSS, jQuery or React to Filtering Data Client-Side

Filtering Data Client-Side. Let's look at how we might do that with different technologies is CSS, jQuery, and React

Say you have a list of 100 names:

<ul>
  <li>Randy Hilpert</li>
  <li>Peggie Jacobi</li>
  <li>Ethelyn Nolan Sr.</li> 
  <!-- and then some -->
</ul>

...or file names, or phone numbers, or whatever. And you want to filter them client-side, meaning you aren't making a server-side request to search through data and return results. You just want to type "rand" and have it filter the list to include "Randy Hilpert" and "Danika Randall" because they both have that string of characters in them. Everything else isn't included in the results.

Let's look at how we might do that with different technologies.

CSS: can sorta do it, with a little help.

CSS can't select things based on the content they contain, but it can select on attributes and the values of those attributes. So let's move the names into attributes as well.

<ul>
  <li data-name="Randy Hilpert">Randy Hilpert</li>
  <li data-name="Peggie Jacobi">Peggie Jacobi</li>
  <li data-name="Ethelyn Nolan Sr.">Ethelyn Nolan Sr.</li> 
  ...
</ul>

Now to filter that list for names that contain "rand", it's very easy:

li {
  display: none;
}
li[data-name*="rand" i] {
  display: list-item;
}

Note the i on Line 4. That means "case insensitive" which is very useful here.

To make this work dynamically with a filter <input>, we'll need to get JavaScript involved to not only react to the filter being typed in, but generate CSS that matches what is being searched.

Say we have a <style> block sitting on the page:

<style id="cssFilter">
  /* dynamically generated CSS will be put in here */
</style>

We can watch for changes on our filter input and generate that CSS:

filterElement.addEventListener("input", e => {
  let filter = e.target.value;
  let css = filter ? `
    li {
      display: none;
    }
    li[data-name*="${filter}" i] {
      display: list-item;
    }
  ` : ``;
  window.cssFilter.innerHTML = css;
});

Note that we're emptying out the style block when the filter is empty, so all results show.

jQuery: makes it even easier.

Since we need JavaScript anyway, perhaps jQuery is an acceptable tool. There are two notable changes here:

  • jQuery can select items based on the content they contain. It has a selector API just for this. We don't need the extra attribute anymore.
  • This keeps all the filtering to a single technology.

We still watch the input for typing, then if we have a filter term, we hide all the list items and reveal the ones that contain our filter term. Otherwise, we reveal them all again:

const listItems = $("li");

$("#filter").on("input", function() {
  let filter = $(this).val();
  if (filter) {
    listItems.hide();
    $(`li:contains('${filter}')`).show();
  } else {
    listItems.show();
  }
});

It's takes more fiddling to make the filter case-insensitive than CSS does, but we can do it by overriding the default method:

jQuery.expr[':'].contains = function(a, i, m) {
  return jQuery(a).text().toUpperCase()
      .indexOf(m[3].toUpperCase()) >= 0;
};

React: can do it with state and rendering only what it needs.

There is no one-true-way to do this in React, but I would think it's React-y to keep the list of names as data (like an Array), map over them, and only render what you need. Changes in the input filter the data itself and React re-renders as necessary.

If we have an names = [array, of, names], we can filter it pretty easily:

filteredNames = names.filter(name => {
  return name.includes(filter);
});

This time, case sensitivity can be done like this:

filteredNames = names.filter(name => {
  return name.toUpperCase().includes(filter.toUpperCase());
});

Then we'd do the typical .map() thing in JSX to loop over our array and output the names.

I don't have any particular preference

This isn't the kind of thing you choose a technology for. You do it in whatever technology you already have. I also don't think any one approach is particularly heavier than the rest in terms of technical debt.

Thanks for reading! Please share if you liked it!

Originally published on css-tricks.com

Database Management Tutorial - Database Design and Management

Database Management Tutorial - Database Design and Management

Learn how to design and manage database with ERD, database generation and reversal with Visual Paradigm.

Learn how to design and manage database with ERD, database generation and reversal with Visual Paradigm.

Database Design and Management is tailor-made for software development teams who need to develop application or software system that require data persistence. All lectures come with clear voice-over as well as demonstrations to walk you through different tools step by step. We are sure you can master database design and management skills with ease and learn most key features in Visual Paradigm after attending the lectures.

The lectures cover a wide range of contents. Firstly, you will start by an introduction of database design, with description of ERD, entity and column. After gaining a better knowledge about ERD, you can then jump to keys, relationships, database view, triggers and stored procedures. This course also covers database management skills like the generation of database from ERD, database patching and reverse engineering of ERD. Developers may want to study the lecture about ORM for system development with database. Last but not least, the training introduces some best practices in database design and management, as well as the usage of data specification.

Once you have completed this online training, you will know how to design database productively and effectively.

What you'll learn

  • Design database with ERD
  • Maintain database productively and effectively
  • Use Visual Paradigm in database design
  • Use Visual Paradigm in database management