DataTable multi select - overriding with CNTRL or SHIFT

DataTable multi select - overriding with CNTRL or SHIFT

RNA_PolymeraseRNA_Polymerase Posts: 2Questions: 0Answers: 0
edited November 2012 in TableTools
I need to be able to configure TableTools to do multi selects with more standard GUI defaults ("Hold CNTRL to select Multiple"). The most important of these two is the CNTRL method. Essentially it would function like this: once "sRowSelect" is set at "single", holding the CNTRL button would move you into "mutli" select mode. Release the CNTRL button would put you back into "single" select mode. Any one found a way to do this or at least perhaps a button to toggle between Single and Multi select?

Also, as an additional bonus, it would be great to have the other GUI default ("Hold SHIFT to Select a range"). But that one is not pressing for my needs right now.

Replies

  • RNA_PolymeraseRNA_Polymerase Posts: 2Questions: 0Answers: 0
    Ok, here is a possibility for one way to tackle this - the toggle button. I decided to take a shot at it (since I am in a rush). It might be helpful for someone (as it does work).

    [code]
    $('#invoiceList').dataTable({
    "sDom": 'T<"clear">lfrtip',
    "oTableTools": {
    "sRowSelect": "single",
    "aButtons": [
    {
    "sExtends": "text",
    "sButtonText": "Multi-Select",
    "fnClick": function ( nButton, oConfig, oFlash ) {
    var selectSetting = this.s;
    if (selectSetting.select.type == "single" || selectSetting.select.type == "none") {
    selectSetting.select.type = "multi";
    nButton.innerText = "Single-Select";
    }
    else if (selectSetting.select.type == "multi") {
    selectSetting.select.type = "single";
    nButton.innerText = "Multi-Select";
    }
    }
    }
    , "select_all"
    , "select_none"
    ]
    },
    });
    [/code]

    Note: I also added the "Select all" and "Deselect all" buttons here because they fit for my purposes.
  • allanallan Posts: 63,497Questions: 1Answers: 10,470 Site admin
    Hi,

    There is no built in way to do a shift select in TableTools - that would require a change to the core code. I think it would be a good one to make (adding another selection type basically that will account for shift, ctrl clicks) but its not something it does yet. Added to the TableTools road map, but that is likely a good 6 months off with all the other work needed on DataTables at the moment!

    Allan
This discussion has been closed.