Flexigrid 插件 - 更改调整大小栏的位置和鼠标移动
我正在尝试使用 Flexigrid 表,问题是我不希望它位于页面的顶部或中间,而是位于底部。
因此,我需要将调整大小栏从表格底部重新定位到顶部,并更改调整大小移动(因为该表格似乎已创建为仅位于页面顶部,向下拉调整栏会放大 div 并拉动/向上推它会变小,我需要相反的)。
我一直在寻找解决这个问题的方法有一段时间了,但还没有找到任何可以解决这个问题的方法。如果可能的话,我想在不更改 flexigrid 插件的情况下执行此操作(如果这不可能,那么也可以)。
(我直接使用来自flexigrid网站的代码,但会发布以防万一出现问题,或者我可以在那里添加一些代码来解决这个问题)
$(document).ready(function(){
$("#sentaku_results").flexigrid({
//url: 'post2.php',
//dataType: 'json',
colModel : [
{display: 'Count', name : 'column1', width : 100, sortable : true, align: 'center'},
{display: '地図', name : 'column2', width : 100, sortable : true, align: 'center'},
{display: '大字名', name : 'column3', width : 100, sortable : true, align: 'center'},
{display: '小字名', name : 'column4', width : 100, sortable : true, align: 'center'},
{display: '本番', name : 'column5', width : 100, sortable : true, align: 'center'},
{display: '枝番', name : 'column6', width : 100, sortable : true, align: 'center'},
{display: '孫番', name : 'column7', width : 100, sortable : true, align: 'center'},
{display: 'ひ孫番', name : 'column8', width : 100, sortable : true, align: 'center'},
{display: '所有者氏名', name : 'column9', width : 220, sortable : true, align: 'center'}
],
buttons : [
//{name: 'Add', bclass: 'add', onpress : test},
//{name: 'Delete', bclass: 'delete', onpress : test},
{separator: true},
{name: 'A', onpress: sortAlpha},
{name: 'B', onpress: sortAlpha},
{name: 'C', onpress: sortAlpha},
{name: 'D', onpress: sortAlpha},
{name: 'E', onpress: sortAlpha},
{name: 'F', onpress: sortAlpha},
{name: 'G', onpress: sortAlpha},
{name: 'H', onpress: sortAlpha},
{name: 'I', onpress: sortAlpha},
{name: 'J', onpress: sortAlpha},
{name: 'K', onpress: sortAlpha},
{name: 'L', onpress: sortAlpha},
{name: 'M', onpress: sortAlpha},
{name: 'N', onpress: sortAlpha},
{name: 'O', onpress: sortAlpha},
{name: 'P', onpress: sortAlpha},
{name: 'Q', onpress: sortAlpha},
{name: 'R', onpress: sortAlpha},
{name: 'S', onpress: sortAlpha},
{name: 'T', onpress: sortAlpha},
{name: 'U', onpress: sortAlpha},
{name: 'V', onpress: sortAlpha},
{name: 'W', onpress: sortAlpha},
{name: 'X', onpress: sortAlpha},
{name: 'Y', onpress: sortAlpha},
{name: 'Z', onpress: sortAlpha},
{name: '#', onpress: sortAlpha}
],
searchitems : [
{display: 'Count', name : 'column1'},
{display: '地図', name : 'column2'},
{display: '大字名', name : 'column3'},
{display: '小字名', name : 'column4'},
{display: '本番', name : 'column5'},
{display: '枝番', name : 'column6'},
{display: '孫番', name : 'column7'},
{display: 'ひ孫番', name : 'column8'},
{display: '所有者氏名', name : 'column9', isdefault: true}
],
sortname: "Count",
sortorder: "asc",
usepager: true,
title: '土地情報検索結果',
useRp: true,
rp: 10,
showTableToggleBtn: true,
width: $('#search_results').innerWidth(),
height: 50
});
});
function sortAlpha(com){
$('#flex1').flexOptions({newp:1, params:[{name:'letter_pressed', value:com}, {name:'qtype',value:$('select[name=qtype]').val()}]});
$("#flex1").flexReload();
}
function test(com,grid){
if (com=='Delete'){
if($('.trSelected',grid).length>0){
if(confirm('Delete ' + $('.trSelected',grid).length + ' items?')){
var items = $('.trSelected',grid);
var itemlist ='';
for(i=0;i<items.length;i++){
itemlist+= items[i].id.substr(3)+",";
}
$.ajax({
type: "POST",
dataType: "json",
url: "delete.php",
data: "items="+itemlist,
success: function(data){
alert("Query: "+data.query+" - Total affected rows: "+data.total);
$("#sentaku_results").flexReload();
}
});
}
}
else{
return false;
}
}
else if(com=='Add'){
alert('Add New Item Action');
}
}
(如果这是一个微不足道的问题,我深表歉意;我不习惯使用 jQuery/jQuery 插件)
感谢您的帮助
中的以下代码,我已经能够将垂直调整大小栏的位置移动到顶部
更新:通过更改 flexigrid.js 文件第 1181 行 之前 $(g.gDiv).prepend(g.mDiv);
更改为 $(g.vDiv).after( g.mDiv);
然后我没有将 Title div 添加到容器顶部,而是将 vGrip div 添加到
第 1083 行 之前 $(g.bDiv).after(g.vDiv);
更改为 $(g.gDiv).prepend( g.vDiv);
抱歉,更新这篇文章花了一段时间,我同时在处理其他几个项目。仍在寻求有关调整大小期间鼠标移动的帮助。
I am trying to use the flexigrid table, the problem is that I do not want it at the top or middle of my page but at the bottom.
So I need to reposition the resize bar from the bottom of the table to the top and change the resize movements(since this table seems to have been created to only be positioned at the top of a page pulling the bar down enlarges the div and pulling/pushing it up makes it smaller, I need this in reverse).
I've been searching for a fix for this for awhile and have not come across anything that even addresses this problem. If possible I would like to do this without making changes to the flexigrid plugin(if this isn't possible then its fine).
(I'm using the code straight from the flexigrid site, but will post just in case something is wrong or I can just add a bit of code there to fix this)
$(document).ready(function(){
$("#sentaku_results").flexigrid({
//url: 'post2.php',
//dataType: 'json',
colModel : [
{display: 'Count', name : 'column1', width : 100, sortable : true, align: 'center'},
{display: '地図', name : 'column2', width : 100, sortable : true, align: 'center'},
{display: '大字名', name : 'column3', width : 100, sortable : true, align: 'center'},
{display: '小字名', name : 'column4', width : 100, sortable : true, align: 'center'},
{display: '本番', name : 'column5', width : 100, sortable : true, align: 'center'},
{display: '枝番', name : 'column6', width : 100, sortable : true, align: 'center'},
{display: '孫番', name : 'column7', width : 100, sortable : true, align: 'center'},
{display: 'ひ孫番', name : 'column8', width : 100, sortable : true, align: 'center'},
{display: '所有者氏名', name : 'column9', width : 220, sortable : true, align: 'center'}
],
buttons : [
//{name: 'Add', bclass: 'add', onpress : test},
//{name: 'Delete', bclass: 'delete', onpress : test},
{separator: true},
{name: 'A', onpress: sortAlpha},
{name: 'B', onpress: sortAlpha},
{name: 'C', onpress: sortAlpha},
{name: 'D', onpress: sortAlpha},
{name: 'E', onpress: sortAlpha},
{name: 'F', onpress: sortAlpha},
{name: 'G', onpress: sortAlpha},
{name: 'H', onpress: sortAlpha},
{name: 'I', onpress: sortAlpha},
{name: 'J', onpress: sortAlpha},
{name: 'K', onpress: sortAlpha},
{name: 'L', onpress: sortAlpha},
{name: 'M', onpress: sortAlpha},
{name: 'N', onpress: sortAlpha},
{name: 'O', onpress: sortAlpha},
{name: 'P', onpress: sortAlpha},
{name: 'Q', onpress: sortAlpha},
{name: 'R', onpress: sortAlpha},
{name: 'S', onpress: sortAlpha},
{name: 'T', onpress: sortAlpha},
{name: 'U', onpress: sortAlpha},
{name: 'V', onpress: sortAlpha},
{name: 'W', onpress: sortAlpha},
{name: 'X', onpress: sortAlpha},
{name: 'Y', onpress: sortAlpha},
{name: 'Z', onpress: sortAlpha},
{name: '#', onpress: sortAlpha}
],
searchitems : [
{display: 'Count', name : 'column1'},
{display: '地図', name : 'column2'},
{display: '大字名', name : 'column3'},
{display: '小字名', name : 'column4'},
{display: '本番', name : 'column5'},
{display: '枝番', name : 'column6'},
{display: '孫番', name : 'column7'},
{display: 'ひ孫番', name : 'column8'},
{display: '所有者氏名', name : 'column9', isdefault: true}
],
sortname: "Count",
sortorder: "asc",
usepager: true,
title: '土地情報検索結果',
useRp: true,
rp: 10,
showTableToggleBtn: true,
width: $('#search_results').innerWidth(),
height: 50
});
});
function sortAlpha(com){
$('#flex1').flexOptions({newp:1, params:[{name:'letter_pressed', value:com}, {name:'qtype',value:$('select[name=qtype]').val()}]});
$("#flex1").flexReload();
}
function test(com,grid){
if (com=='Delete'){
if($('.trSelected',grid).length>0){
if(confirm('Delete ' + $('.trSelected',grid).length + ' items?')){
var items = $('.trSelected',grid);
var itemlist ='';
for(i=0;i<items.length;i++){
itemlist+= items[i].id.substr(3)+",";
}
$.ajax({
type: "POST",
dataType: "json",
url: "delete.php",
data: "items="+itemlist,
success: function(data){
alert("Query: "+data.query+" - Total affected rows: "+data.total);
$("#sentaku_results").flexReload();
}
});
}
}
else{
return false;
}
}
else if(com=='Add'){
alert('Add New Item Action');
}
}
(Apologies if this is a trivial question; I'm not used to using jQuery/jQuery plugins)
Thanks for your help
Update: I have been able to move the position of the vertical resize bar to the top by changing the following code in the flexigrid.js file
Line 1181
Before $(g.gDiv).prepend(g.mDiv);
Changed to $(g.vDiv).after(g.mDiv);
and then instead of prepend the Title div to the top of the container, I prepend the vGrip div
Line 1083
Before $(g.bDiv).after(g.vDiv);
Changed to $(g.gDiv).prepend(g.vDiv);
Sorry its taken awhile to update this post, been working on a few other projects simultaneously. Still looking for help on the mouse movement during resize.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论