Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Custom Checkbox column in listview (not showSelectCheckboxUA) #2653

Closed
ghigio2000 opened this issue Sep 10, 2018 · 12 comments
Closed

Add Custom Checkbox column in listview (not showSelectCheckboxUA) #2653

ghigio2000 opened this issue Sep 10, 2018 · 12 comments
Assignees

Comments

@ghigio2000
Copy link

ghigio2000 commented Sep 10, 2018

I would like to have a column of checkboxes in the listview.
I tried using "showSelectCheckboxUA" and it works, but I need to avoid "unselect all" on a filename selection in the listview.
I try to explain better my need.
When the user check the checkbox for a series of files I will display the files-content on a map. While on dblclick on one filename I will open the details of that particular file only.
So when dblclick on a file I do not want to uncheck all those checked.
Hope it is clear.

thanks for your help.

@ghigio2000
Copy link
Author

Maybe I have not explained properly, let me try to rephrase my question.
I would like to add in the listview a new column to set a file property.
It is a checkbox that I will use onchecked or onunchecked for my scope.

Hope this is possible, if not please answer me anyway. Thanks, appreciated.

@ghigio2000
Copy link
Author

@nao-pon
do you have any suggestion?
Thanks in advance for your help.

@ghigio2000 ghigio2000 changed the title Checkbox column in listview Add Custom Checkbox column in listview (not showSelectCheckboxUA) Sep 13, 2018
@nao-pon
Copy link
Member

nao-pon commented Sep 13, 2018

@ghigio2000 What you want is not to control file selection from other than checkbox?

@ghigio2000
Copy link
Author

ghigio2000 commented Sep 13, 2018

@nao-pon What I want is to have a checkbox for each file in the listview, that I can check or uncheck as I wish and have an event linked to this click. Nothing to do with the selection.
Something like this

immagine

I would like to be able to run a command on a file with just one click, and not with a click to select and then another click to run my command.
It is an HIDE/SHOW layers on a map.

@nao-pon
Copy link
Member

nao-pon commented Sep 14, 2018

@ghigio2000 You can add a check box with the following settings. However, since there are some problems with check box event handling, I will fix it.

uiOptions : {
    cwd : {
        listView : {
            columns : ['perm', 'date', 'size', 'kind', 'sel']
        },
        replacement : {
            sel : function(f, fm) {
                return '<input type="checkbox" class="elfinder-cwd-nonselect elfinder-cwd-list-sel" data-hash="'+f.hash+'"/>';
            }
        }
    }
}

@nao-pon nao-pon self-assigned this Sep 14, 2018
@nao-pon
Copy link
Member

nao-pon commented Sep 15, 2018

@ghigio2000 I fixed a bug. Please try with nightly build with...

bootCallback : function(fm, extraObj) {
    fm.bind('init', function() {
        fm.getUI('cwd').on('click', 'input.elfinder-cwd-list-chk', function() {
            var chk = $(this);
            fm.log([chk.data('hash'), chk.is(':checked')]);
        });
    });
},
uiOptions: {
    cwd: {
        listView : {
            columns : ['url', 'date', 'size', 'kind', 'chk']
        },
        replacement : {
            chk : function(f, fm) {
                return '<input type="checkbox" class="elfinder-cwd-nonselect elfinder-cwd-list-chk" data-hash="'+f.hash+'"/>';
            }
        }
    }
}

@nao-pon nao-pon added the howto label Sep 15, 2018
@ghigio2000
Copy link
Author

ghigio2000 commented Sep 17, 2018

Thanks it works but not completely.

  1. this checkbox should remember its value for the entire session. So if I check a file, then change folder, when I came back that file must be still checked.
  2. It would be perfect, if I can select multiple files and then press once a checkbox to check/uncheck all those selected.
    Should I open a new request?
    thanks a lot for your work and help.

@nao-pon
Copy link
Member

nao-pon commented Sep 17, 2018

@ghigio2000

  1. Please implement it yourself using sessionStorage etc.

  2. Calling elfinderInstance.selected() will get an array of hashes of the selected items. Please implement it yourself using this.

@ghigio2000
Copy link
Author

@nao-pon I do not find any documentation/explanation of the sessionStorage you mention above.

@nao-pon
Copy link
Member

nao-pon commented Sep 18, 2018

@ghigio2000 elFinder does not use sessionStorage. You need to handle sessionStorage using JavaScript. I'd suggest checking the sessionStorage with 'replacement' and adding the checked attribute as necessary.

@ghigio2000
Copy link
Author

@nao-pon

Hi, I almost completed my implementation of these checkbox but testing on mobile they are not showing the tick when checked (it looks like they are disabled, but in reality the bootCallback works).
Can you fix it?
thanks

@nao-pon nao-pon reopened this Oct 6, 2018
@nao-pon
Copy link
Member

nao-pon commented Oct 6, 2018

@ghigio2000 Yes, I was able to reproduce the problem. I will fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants