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

Make some fields mandatory - eg "tagging" etc #1199

Open
davmlaw opened this issue Nov 19, 2024 · 2 comments
Open

Make some fields mandatory - eg "tagging" etc #1199

davmlaw opened this issue Nov 19, 2024 · 2 comments

Comments

@davmlaw
Copy link
Contributor

davmlaw commented Nov 19, 2024

ID/chrom/pos/ref/alt, tagging are obvious ones

Some way to ensure they stay in there.

@davmlaw
Copy link
Contributor Author

davmlaw commented Nov 21, 2024

Added a "mandatory" class to the ones I want to keep

Having bit of issue with Jquery sortable in view_custom_columns.html - need to be able to allow moving within one but not moving from one to two. "ui.sender" seems null always

Here is trigger order:

Moving from one to two

one: start
one: sortupdate
two: received
two: stop


Moving within one

one: start
one: sortupdate
two: received
two: stop

@davmlaw
Copy link
Contributor Author

davmlaw commented Nov 28, 2024

Not quite working code was:

        let suppressUpdate = false;  // Need to disable mandatory ones
		$("#my_columns_sortable").sortable({
		    items: "li.user-column",
		    placeholder: "sort_placeholder",
		    connectWith: '#available_columns_sortable',
            start: function(event, ui) {
                console.log("my clumns start");
                console.log(event);
                console.log(ui);
                if ($(ui.item).hasClass("mandatory")) {
                    suppressUpdate = true;
                }
            },
            stop: function(event, ui) {
                console.log("my columns stop");
                suppressUpdate = false; // Reset the flag after sorting is complete
            }
		}).on("sortupdate", function(event, ui) {
            console.log("sortupdate");
            console.log(ui);
            if (suppressUpdate) {
                console.log("my columns suppressed update");
                return
            }
            const result_my_columns = serialize_columns("#my_columns_sortable");

            $.ajax({
                type: "POST",
		        data: 'columns=' + result_my_columns + '&my_columns=true',
		        url: "{{ request.path }}",
            });
		}).disableSelection();


		$("#available_columns_sortable").sortable({
		    items: "li.user-column",
		    placeholder: "sort_placeholder",
		    connectWith: '#my_columns_sortable',
            // Don't allow mandatory items in here
            receive: function(event, ui) {
                console.log("Received item in 'two'");
                if ($(ui.item).hasClass("mandatory")) {
                    $(ui.sender).sortable('cancel');
                    suppressUpdate = true; // Set the flag when receiving an item
                }
            },
            stop: function(event, ui) {
              suppressUpdate = false; // Reset the flag after sorting is complete
            }
		}).on("sortupdate", function(event, ui) {
            console.log("TWO: sortupdate");
		}).disableSelection();

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

No branches or pull requests

1 participant