Avoid manually constructing URLs.

This means that URLs with query parameters are no longer incorrectly
created.

Closes #6, #23, #27.
This commit is contained in:
Andrew Short 2013-10-08 09:30:59 +11:00
parent 712c5070e9
commit 82bb0524b3
2 changed files with 8 additions and 2 deletions

View File

@ -86,9 +86,15 @@ class GridFieldOrderableRows extends RequestHandler implements
);
}
/**
* @param GridField $field
*/
public function getHTMLFragments($field) {
GridFieldExtensions::include_requirements();
$field->addExtraClass('ss-gridfield-orderable');
$field->setAttribute('data-url-reorder', $field->Link('reorder'));
$field->setAttribute('data-url-movetopage', $field->Link('movetopage'));
}
public function augmentColumns($grid, &$cols) {

View File

@ -192,7 +192,7 @@
});
grid.reload({
url: grid.data("url") + "/reorder",
url: grid.data("url-reorder"),
data: data.get()
});
};
@ -228,7 +228,7 @@
grid.find("tbody").sortable("cancel");
grid.reload({
url: grid.data("url") + "/movetopage",
url: grid.data("url-movetopage"),
data: [
{ name: "move[id]", value: ui.draggable.data("id") },
{ name: "move[page]", value: page }