Multi select doesn't work

Multi select doesn't work

yishayhyishayh Posts: 108Questions: 17Answers: 0
edited May 2016 in Select

Hi Allan,

Multi-select doesn't work for us.
We are implemented datatable as an anjular directive.
The table is mostly dynamic, and in the context of the select we pass the following parameters to the Datatable function:

{
columnDefs: [ {
              orderable: false,
              className: 'select-checkbox',
              targets:   0
            }],
select: {
            style:    'os',
            selector: 'td:first-child',
            blurable: false
          }

It seems the problem is in jquery.datatable.js in _Api.registerPlural function.
It receives in its arguments that select === false.

Thanks,
Yishay

Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Answers

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin

    Could you please link to a test case showing the issue. http://live.datatables.net and JSFiddle (among others) are available to host code if you can't host the page yourself.

    Here is a trivial test page that appears to show your code above working okay: http://live.datatables.net/lafezagi/1/edit .

    Allan

  • yishayhyishayh Posts: 108Questions: 17Answers: 0

    Hi Allan,

    I didn't get the automatic messages so I missed your answer.
    I'm sorry, but this is an internal implementation and it's a lot of code.
    Can you direct me where to look in your code in order to investigate this further so I can try and reconstruct the issue with simple example?
    Currently, it seems the problem is in jquery.datatable.js in _Api.registerPlural function.
    It receives in its arguments that select === false.

    Thanks,
    Yishay

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin

    The link I gave above is a simple example that shows the multi select working. Are you able to modify that to show the error case you are encountering?

    Allan

  • yishayhyishayh Posts: 108Questions: 17Answers: 0

    Hi Allan,

    Our solution is json based, do you have some example that I can start with, or do I need to reconstruct it from scratch?

    Thanks,
    Yishay

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin

    This page describes how Ajax sourced data can be used on the live site. There are also template examples which could be used as a base.

    I'd be a little surprised if Ajax sourced data has an impact here - but who knows where the issue is!

    Allan

  • yishayhyishayh Posts: 108Questions: 17Answers: 0

    Hi Allan,

    I'm sorry, but I think I wrong something wrong.
    We are using jquery.datatable.js version 1.10.9, could that be the problem, did the API changed since than?

    Thanks,
    Yishay

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin

    I don't believe so. I would recommend updating to the latest versions of the software you are using however, And if that doesn't help to resolve the issue I would need to be able to access a page showing the issue so it can be debugged. The live site, JSFiddle, CodePen or many others can be used.

    Allan

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin

    Thanks for the link in the PM. Multi-row selection isn't working because it has been specifically set to single row selection by this block of code:

              tableOptions.select = {
                style:    'single',
                selector: 'td:first-child',
                blurable: true
              };
    

    I can't say what file that is in since it is minified (script.js) but multi-row selection isn't working because it has been disabled.

    Allan

  • yishayhyishayh Posts: 108Questions: 17Answers: 0

    Hi Allan,

    Sorry, someone must of change it, I changed it back to 'os' and it still doesn't work.
    I tried to select two lines by clicking one and than clicking the other while pressing ctrl.

    Thanks,
    Yishay

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin

    You have a function:

    $(tElement).on('click', 'td.select-checkbox', function (e) {
    

    it is that which appears to be deselecting the previously selected row. At a guess, from the comment in the function, it appears that is trying to allow Select and FixedColumns to be used together. That shouldn't be required with the latest versions of Select and FixedColumns - example.

    Allan

  • yishayhyishayh Posts: 108Questions: 17Answers: 0

    Hi Allan,

    I think this is it, I'll try updating the datatable and plugins version and see if it solves the issue.

    Many thanks,
    Yishay

  • yishayhyishayh Posts: 108Questions: 17Answers: 0

    Hi Allan,

    this might sound stupid, but what is the best why to upgrade?
    Is it safer to use the builder, or should we use bower?

    Thanks,
    Yishay

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin

    Personally I like the download builder, but if you prefer bower or NPM, then those options are available.

    Allan

  • yishayhyishayh Posts: 108Questions: 17Answers: 0

    Hi Allan,

    If you prefer it, than we prefer it too..

    When trying to fully download using the builder I get:
    Error: Large number of files requested - Unfortunately the downloader can't cope at the moment. Please hit back and select less libraries. This is being worked on! Sorry for the inconvenience.

    The full link is:
    https://datatables.net/download/builder?bs-3.3.6/jszip-2.5.0,pdfmake-0.1.18,moment-2.13.0,ed-mask-1.13.4,selectize-0.12.1,dt-1.10.12,b-1.2.1,b-colvis-1.2.1,b-flash-1.2.1,b-html5-1.2.1,b-print-1.2.1,cr-1.3.2,e-1.5.6,ef-display-1.5.6,ef-mask-1.5.6,ef-select2-1.5.6,ef-selectize-1.5.6,fc-3.2.2,fh-3.1.2,rr-1.1.2,sc-1.4.2,se-1.2.0

    Thanks,
    Yishay

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin

    Sorry - that's being caused by the file system limit of 255 characters in the path. I'm working on a way to address that, probably with a hash. At the moment the only way to work around it is to built two sets of files and then combine them.

    Allan

  • yishayhyishayh Posts: 108Questions: 17Answers: 0

    Hi Allan,

    How can we merge the datatable.js, datatable.css and their minified versions?

    Thanks,
    Yishay

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin

    Copy and paste in your text editor.

    I'm working on how to address this at the moment, but I can't say how long it will take I'm afraid.

    Allan

  • yishayhyishayh Posts: 108Questions: 17Answers: 0

    Hi Allan,

    Would that be a legit merge? Aren't there any duplicate lines between the two files? Would the output of this double copy paste work?

    Thanks,
    Yishay

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin

    Assuming you only select different modules for the two packages that are created, then yes, it would be perfectly valid to do that (that is basically all the builder is doing itself - just pulling in the files from the various sources).

    Allan

  • yishayhyishayh Posts: 108Questions: 17Answers: 0

    Hi Allan,

    I did choose different plugins, but both zip files contains Bootstrap-3.3.6 folder, so I guess there might be some shared code between the different files.

    Thanks,
    Yishay

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin

    It shouldn't if you didn't include the Bootstrap "include library" option. However, i'm making good progress on fixing this and should be able to deploy the update to the site tomorrow.

    Allan

  • yishayhyishayh Posts: 108Questions: 17Answers: 0

    Ok, I'll wait.
    Thanks,
    Yishay

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin

    I'm afraid its going to be tomorrow (Friday) before I deploy this now. I'm confident that it is all ready to go, but because it effects the CDN it isn't easy to correct anything that does happen to go wrong, so I'll wait for a low point in traffic to the server (tomorrow morning).

    Allan

  • yishayhyishayh Posts: 108Questions: 17Answers: 0

    Hi allan,

    any news regarding this?

    Thanks,
    Yishay

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin

    Yes, it is done. The download builder will no longer give the "Large number of files requested" error.

    Allan

  • yishayhyishayh Posts: 108Questions: 17Answers: 0

    Great news !
    thanks,
    Yishay

  • yishayhyishayh Posts: 108Questions: 17Answers: 0

    Hi Allan,

    I'm trying to upgrade to the new datatable version, but I get the following error, can you take a look and tell me what's wrong?

    Many thanks,
    yishay

    i happens when I try to init the element
    tElement.DataTable(tableOptions);
    I can't stringify the tableOptions (I get: Uncaught TypeError: Converting circular structure to JSON) so if you need any of the init variables just tell me.
    angular.js:12722 TypeError: Cannot read property 'fnInit' of undefined
    at _fnFeatureHtmlPaginate (http://localhost:3000/datatables_new/version-1.10.12/datatables.js:85967:10)
    at _fnAddOptionsHtml (http://localhost:3000/datatables_new/version-1.10.12/datatables.js:84764:19)
    at _fnInitialise (http://localhost:3000/datatables_new/version-1.10.12/datatables.js:85790:3)
    at HTMLTableElement.<anonymous> (http://localhost:3000/datatables_new/version-1.10.12/datatables.js:82450:5)
    at Function.each (http://localhost:3000/bower_components/jquery/dist/jquery.js:374:23)
    at jQuery.each (http://localhost:3000/bower_components/jquery/dist/jquery.js:139:17)
    at jQuery.DataTable (http://localhost:3000/datatables_new/version-1.10.12/datatables.js:81980:8)
    at jQuery.$.fn.DataTable (http://localhost:3000/datatables_new/version-1.10.12/datatables.js:96216:18)
    at http://localhost:3000/js/components/shared/datatable/datatable.js:665:37
    at http://localhost:3000/bower_components/angular/angular.js:18132:31 undefined

  • yishayhyishayh Posts: 108Questions: 17Answers: 0

    Hi Allan,

    I hope this will you help us.
    It happens because bootstrap_full_number plugin is missing.

    Thanks,
    Yishay

  • yishayhyishayh Posts: 108Questions: 17Answers: 0

    Hi Allan,

    forget about the last two questions, this answered me.

    Thanks,
    Yishay

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin

    Thanks for posting back - good to hear you have it working now.

    Allan

This discussion has been closed.