MM5 CheckBox in MediaTree Playlist?

To discuss development of addons / skins / customization of MediaMonkey.

Moderators: jiri, drakinite, Addon Administrators

Erwin Hanzl
Posts: 1189
Joined: Tue Jun 13, 2017 8:47 am
Location: Vienna

MM5 CheckBox in MediaTree Playlist?

Post by Erwin Hanzl »

https://ej2.syncfusion.com/documentatio ... check-box/
CheckBox in JavaScript TreeView control
11 Feb 2022 / 5 minutes to read

The TreeView component allows you to check more than one node in TreeView without affecting the UI’s appearance by enabling the showCheckBox property. When this property is enabled, checkbox appears before each TreeView node text.

If one of the child nodes is not in a checked state, then the parent node will be in an intermediate state.
If all the child nodes are in checked state, then the parent node’s state will also be checked.
If a parent node is checked, then all the child nodes’ state will also be checked.

By default, the checkbox state of parent and child nodes are dependent on each other. If you need independent checked state, you can achieve it using the autoCheck property.

Using the checkedNodes property, you can set the nodes that need to be checked or get the ID of nodes that are currently checked in the TreeView component.

If you need to prevent the node check action for a particular node, the nodeChecking event can be used which is triggered before the TreeView node is checked/unchecked. The nodeChecked event will be triggered when the TreeView node is checked/unchecked successfully.

In the following example, the showCheckBox property is enabled.
Is it possible to apply this method ONLY to playlists? https://www.mediamonkey.com/forum/viewt ... b25b767c34
Image
MMW 4.1.31.1919 Gold-Standardinstallation
Erwin Hanzl
Posts: 1189
Joined: Tue Jun 13, 2017 8:47 am
Location: Vienna

Re: MM5 CheckBox in MediaTree Playlist?

Post by Erwin Hanzl »

No answer from the developer corner?
MMW 4.1.31.1919 Gold-Standardinstallation
Ludek
Posts: 4959
Joined: Fri Mar 09, 2007 9:00 am

Re: MM5 CheckBox in MediaTree Playlist?

Post by Ludek »

It is like this:

Code: Select all

MediaTree.prototype.override({
    initialize: function ($super, rootElem, params) {
        $super(rootElem, params);
        this.checkboxes = true;
    },
    bindData: function ($super, div, index) {
        $super(div, index);
        var node = this.dataSource.getNodeByIndex(index);

        if (div.check && node && node.handlerID != 'playlist')
            div.check.style.display = 'none' // set display = 'none' so that the checkbox does not take any space        
    }
});

Sample addon:
https://www.dropbox.com/s/br66a5tsxmmg7 ... .mmip?dl=0

Result:
https://www.dropbox.com/s/m26e2q6jwzwns ... 7.png?dl=0
Erwin Hanzl
Posts: 1189
Joined: Tue Jun 13, 2017 8:47 am
Location: Vienna

Re: MM5 CheckBox in MediaTree Playlist?

Post by Erwin Hanzl »

Hello Ludek,

that's a great start.
But it's all about managing individual songs in conjunction with playlists.

Managing playlists made easy.
For ONE selected song, the playlists in which the song occurs should be marked with a tick.
1. Remove hook: Remove from specific playlist
2. Add hook: add to specific playlist
3. Furthermore, the possibility to expand the sub-playlists automatically.

Please read the following link: https://www.mediamonkey.com/forum/viewt ... b25b767c34

Shouldn't you reach ALL users, regardless of whether they need it or not.
I think album collectors are happy with the album management.
And the playlist-enthusiasts should be made happy too.


Image
Last edited by Erwin Hanzl on Mon Mar 21, 2022 1:11 pm, edited 5 times in total.
MMW 4.1.31.1919 Gold-Standardinstallation
Ludek
Posts: 4959
Joined: Fri Mar 09, 2007 9:00 am

Re: MM5 CheckBox in MediaTree Playlist?

Post by Ludek »

My understanding was that you are about to develop such a addon and are asking how to do it?

Feel free to expand my sample above.
Note that node.dataSource is the Playlist object: https://www.mediamonkey.com/docs/api/cl ... ylist.html

So to exclude auto-playlists use code like this:

Code: Select all

MediaTree.prototype.override({
    initialize: function ($super, rootElem, params) {
        $super(rootElem, params);
        this.checkboxes = true;
    },
    bindData: function ($super, div, index) {
        $super(div, index);
        var node = this.dataSource.getNodeByIndex(index);

        var playlist;
        if (node && node.handlerID == 'playlist' && !node.dataSource.isAutoPlaylist) {
            playlist = node.dataSource;
            node.checked = true; // LS: this sets the checked state
        }
        
        if (div.check && !playlist)
            div.check.style.display = 'none' // set display = 'none' so that the checkbox does not take any space        
    }
});
But it sounds to me that the functionality is redundant, because what you are looking for is already a native function in Properties > Classification > Playlists

EDIT: Alternativelly if you still wants this to be part of main panel then it might be better to introduce another component that will list the playlists without auto-playlists and not to be dependent on the Media Tree -- as clicking a Media Tree node currently also changes the view, which is unwaned in your scenario.
Erwin Hanzl
Posts: 1189
Joined: Tue Jun 13, 2017 8:47 am
Location: Vienna

Re: MM5 CheckBox in MediaTree Playlist?

Post by Erwin Hanzl »

Hi Ludek,
My understanding was that you are about to develop such a addon and are asking how to do it?
No, I am NOT a JavaSripter. I can not do that. But the MM developers should finally cover the needs of a large number of users.
function in Properties > Classification > Playlists
This function is absolutely unsuitable for this.
Yes, you can remove playlist entries, but not add them.
In addition, this window covers a not inconsiderable part of the entire screen.
In addition, I always have to close this window before I get to the next title.

Regards
Erwin
MMW 4.1.31.1919 Gold-Standardinstallation
Post Reply