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

[REQUEST] Event to indicate that there has been a change in sort order. #39

Closed
ghost opened this issue Jul 25, 2013 · 9 comments
Closed

Comments

@ghost
Copy link

ghost commented Jul 25, 2013

Hi!

To make some operations I need to detect that the user has changed the lines order.
The event should indicate the ID's and classname in which changes have occurred.
The event could be defined in the current controller.
$controller = Controller::curr();
&controller->onBeforeChangeSort(...)

Thank you for this wonderful module.
Jose A.

@UndefinedOffset
Copy link
Owner

Hmm, I'll see what I can do. It may need to happen on the data object because the current controller may not be say the page's controller. Would that work? Though then it would be just notifying that object that it's sort is changing or has changed. That said I'll see what I can do.

@ghost
Copy link
Author

ghost commented Jul 26, 2013

In the case of an inherited dataset controlled for ModelAdmin $controller = Controller::curr() returns the object of class inherited from ModelAdmin, so I think it could work in all normal cases.
Thank you very much for all your efforts.

Regards,
Jose A.

@UndefinedOffset
Copy link
Owner

Ya in the case of a page it would be CMSMain or a subclass of that. Which won't be useful there but, for a sub-class of ModelAdmin I could definitely see it being useful in some cases. I'll look at adding it.

@ghost
Copy link
Author

ghost commented Aug 2, 2013

Any progress in this regard?

Thanks,
Regards,
Jose A.

@UndefinedOffset
Copy link
Owner

No sorry, been flat out at work so I haven't felt much like doing more programming in the evening. I'll try to get it tonight or tomorrow though. Should be a really simple addition.

@ghost
Copy link
Author

ghost commented Aug 3, 2013

Thanks Ed,
Regards,
Jose A.

@UndefinedOffset
Copy link
Owner

I'm thinking it may just make more sense for these events if I passed the datalist instance back, because then you'd have full access to the list as it appears to GridFieldSortableRows and since DataList's are more or less just sql queries unlike the old DataObjectSet you'd be able to iterate the list. It would defiantly make it easier for many many lists that's for sure.

Think that would work for you?

@ghost
Copy link
Author

ghost commented Aug 4, 2013

Perfect, I need exactly the records where there has been a change in the display order.

Thanks Ed,
Regards,
Jose A.

@ghost
Copy link
Author

ghost commented Aug 7, 2013

Great, works perfectly.
Thanks Ed,

Regards,
Jose A.

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

1 participant