Passing conditions to moveUp and moveDown


I’ve build an application where pages have modules. So I have pages, containing many modules, who need to be organise relatively to the page where they are.

My modules have the Tree Behavior and are ordered by lft ASC, which is good. But when I want to move up or move down a module it reorganise all the table and doesn’t take care of the page where are placed the modules.

I’d like to use a condition like :

How to do it correctly ?

Thank you