This commit is contained in:
BoHung Chiu 2023-03-18 17:28:01 +08:00
parent 7616e05258
commit d6a749995f
2 changed files with 22 additions and 22 deletions

View File

@ -88,27 +88,6 @@
$('#backend_fields_analysis').css( 'border','');
}
})
$( ".table tbody td" ).each(function(i,v){
$(v).attr("index",$(v).index());
$(v).html("<span class=\"brand ui-sortable-handle\"><i class=\"icons-list-2\"></i></span>" + $(v).html());
})
$( ".table tbody >" ).sortable({
axis: "x",
revert: true,
handle: ".brand",
update: function(event, ui) {
var new_index = ui.item.index();
var old_index = ui.item.attr("index");
var indices = [new_index,old_index].sort();
for(var new_i=indices[0];new_i<=indices[1];new_i++){
var td = ui.item.parent().find(">").eq(new_i);
var old_i =td.attr("index");
var org_i = td.data("index");
td.attr("index",new_i);
td.find('.fields_order_hidden_input').val(new_i);
}
}
});
$( ".sort_asc_fields, .sort_desc_fields" ).on("click", function(){
var _this = $(this);
if(_this.prop('checked')){
@ -117,4 +96,25 @@
}
})
}
$( ".table tbody td" ).each(function(i,v){
$(v).attr("index",$(v).index());
$(v).html("<span class=\"brand ui-sortable-handle\"><i class=\"icons-list-2\"></i></span>" + $(v).html());
})
$( ".table tbody >" ).sortable({
axis: "x",
revert: true,
handle: ".brand",
update: function(event, ui) {
var new_index = ui.item.index();
var old_index = ui.item.attr("index");
var indices = [new_index,old_index].sort();
for(var new_i=indices[0];new_i<=indices[1];new_i++){
var td = ui.item.parent().find(">").eq(new_i);
var old_i =td.attr("index");
var org_i = td.data("index");
td.attr("index",new_i);
td.find('.fields_order_hidden_input').val(new_i);
}
}
});
</script>

View File

@ -24,7 +24,7 @@ $( ".selectbox" ).ready(function() {
</form>
</div>
<table class="table table-hover table-striped plugin_templates-index dt-responsive nowrap">
<caption><h3>{{widget-title}}</h3></caption>
<caption style="display: none;"><h3>{{widget-title}}</h3></caption>
<thead>
<tr data-level="0" data-list="headers">
<th class="col-md-{{col}}">{{head-title}}</th>