Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8380897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:34:26+00:00 2026-06-09T16:34:26+00:00

When row selection is enabled on a datatable, is there way to limit the

  • 0

When row selection is enabled on a datatable, is there way to limit the number of rows a user can select? I only want users to be able to select a maximum of two rows and a minimum of one in the datatable, but I don’t see an option in the Datatables API that describes how to do this?

Will I need to perform this manually in some callback that’s triggered whenever a user selects a row? I’d like to avoid this if possible. Any help or insight is appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T16:34:27+00:00Added an answer on June 9, 2026 at 4:34 pm

    Ok got an implementation working, so what I ended up doing was instead of limiting the number rows a user can select, I added some logic to deselect any previously selected row whenever a user clicked on another row. I treated the selection order as a queue, which I just implemented using an array, each time I push a new row to the queue, any previous element would get popped.

    The size of the queue determines the number of rows a user can select, by setting the queue size to two, this allows up to two rows to be selected, when an additional row is selected, the first selected row is removed from the queue. I used the fnGetInstance() and fnDeselect() functions below for deselecting rows from my data table instance

    //oldRow = first selected row from queue
    
    var oTT = TableTools.fnGetInstance( 'MyDataTable' );
    oTT.fnDeselect( oldRow );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

the row source for a listbox looks like this: SELECT users.id, users.first, users.last, chavrusas.luser_type
I want to select a particular row of a DevExpress MVC GridView, which contains
I have a JTable with row selection enabled. Before today, my desired functionality was
I have a QTableView instance limited to a single row selection. I don't want
I want to enable the user to highlight a row on the WPF DataGrid
I'm looking for a way to enable multi row select in a DataGridView-Control but
I'm working with the multiple row selection to give a user ability to delete
I would like a DataGridView row selection to behave the same way than when
I am enabling multiple row selection with clicking checkbox Item renderer. this works for
What's the best way for selecting a table row by index using jQuery? Thanks

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.