BUGFIX: got drag and drop ordering of field OPTIONS rewritten in jQuery

This commit is contained in:
Will Rossiter 2009-04-18 03:08:34 +00:00
parent c0b2f760cd
commit e73015e6e5
2 changed files with 45 additions and 17 deletions

View File

@ -147,23 +147,50 @@
/**
* Sort Fields in the Field List
*/
$("#Fields_fields").sortable({
handle : '.fieldHandler',
cursor: 'pointer',
items: 'li.EditableFormField',
placeholder: 'removed-form-field',
opacity: 0.6,
revert: true,
change : function (event, ui) {
$("#Fields_fields").sortable('refreshPositions');
},
update : function (event, ui) {
// get all the fields
var sort = 1;
$("li.EditableFormField").each(function() {
$(this).find(".sortHidden").val(sort++);
});
}
$("#Fields_fields").livequery(function() {
$(this).sortable({
handle : '.fieldHandler',
cursor: 'pointer',
items: 'li.EditableFormField',
placeholder: 'removed-form-field',
opacity: 0.6,
revert: true,
change : function (event, ui) {
$("#Fields_fields").sortable('refreshPositions');
},
update : function (event, ui) {
// get all the fields
var sort = 1;
$("li.EditableFormField").each(function() {
$(this).find(".sortHidden").val(sort++);
});
}
});
});
/**
* Sort Options in a Field List - Such as options in a
* dropdown field.
*/
$(".editableOptions").livequery(function() {
$(this).sortable({
handle : '.handle',
cursor: 'pointer',
items: 'li',
placeholder: 'removed-form-field',
opacity: 0.6,
revert: true,
change : function (event, ui) {
$(this).sortable('refreshPositions');
},
update : function (event, ui) {
// get all the fields
var sort = 1;
$(".editableOptions li").each(function() {
$(this).find(".sortOptionHidden").val(sort++);
});
}
});
});
});
})

View File

@ -2,6 +2,7 @@
<img class="handle" src="sapphire/images/drag.gif" alt="<% _t('DRAG', 'Drag to rearrange order of options') %>" />
$DefaultSelect
<input type="text" name="$Name.Attr[Title]" value="$Title" />
<input type="hidden" class="sortOptionHidden" name="$Name[Sort]" value="$Sort" />
<% if isReadonly %>
<img src="cms/images/locked.gif" alt="<% _t('LOCKED', 'These fields cannot be modified') %>" />