小编dri*_*ger的帖子

jQuery FullCalendar事件排序

我有很多活动都是全天活动,而且都是在同一时间开始的.我按照我希望它们出现在完整日历视图中的顺序创建事件,但它们似乎总是以其他方式排序.

如何按字母或按ID排序事件?

编辑:添加示例数据数组.在日历中,我预计Supervisor事件将每天首先出现,按照字母顺序出现在Tech1和Tech2之前,并且其id也是出租人数,而不是以下事件.相反,我每天都会收到一份随机订单.

例如:

2011-11-05的订单显示为Tech2,Tech1,Tech1,Tech1,Tech2,Supervisor.

2011-11-06的一天,该订单显示为主管,Tech1,Tech1,Tech1,Tech2,Tech2.

我要求排序至少每天都是一致的,理想情况是按标题的字母顺序排列,或者按照id的顺序排列.

var events=[
    {id:1, title:'Supervisor',start:'2011-11-05T00:00:00-05:00',st_hours:10,ot_hours:0,allDay:true},
    {id:2, title:'Tech2',start:'2011-11-05T00:00:00-05:00',st_hours:10,ot_hours:0,allDay:true},
    {id:3, title:'Tech2',start:'2011-11-05T00:00:00-05:00',st_hours:10,ot_hours:0,allDay:true},
    {id:4, title:'Tech1',start:'2011-11-05T00:00:00-05:00',st_hours:10,ot_hours:0,allDay:true},
    {id:5, title:'Tech1',start:'2011-11-05T00:00:00-05:00',st_hours:10,ot_hours:0,allDay:true},
    {id:6, title:'Tech1',start:'2011-11-05T00:00:00-05:00',st_hours:10,ot_hours:0,allDay:true},
    {id:7, title:'Supervisor',start:'2011-11-06T00:00:00-05:00',st_hours:10,ot_hours:0,allDay:true},
    {id:8, title:'Tech2',start:'2011-11-06T00:00:00-05:00',st_hours:10,ot_hours:0,allDay:true},
    {id:9, title:'Tech2',start:'2011-11-06T00:00:00-05:00',st_hours:10,ot_hours:0,allDay:true},
    {id:10, title:'Tech1',start:'2011-11-06T00:00:00-05:00',st_hours:10,ot_hours:0,allDay:true},
    {id:11, title:'Tech1',start:'2011-11-06T00:00:00-05:00',st_hours:10,ot_hours:0,allDay:true},
    {id:12, title:'Tech1',start:'2011-11-06T00:00:00-05:00',st_hours:10,ot_hours:0,allDay:true}
];
Run Code Online (Sandbox Code Playgroud)

EDIT2:此问题似乎只存在于Google Chrome中.事件按照我期望的顺序呈现在IE9和FF8中.我开发的Chrome 15似乎是唯一受影响的浏览器.

铬 火狐 火狐

jquery fullcalendar

7
推荐指数
2
解决办法
1万
查看次数

jqGrid高级搜索'beforeSearch'选项?

我正在使用最优秀的jqGrid插件,并通过搜索在这个网站上找到了很多帮助,但我发现了一个我无法解决的问题,或者找到了解决方案.这将是我在这里的第一篇文章.

我正在使用filterToolbar来搜索我的网格.由于我需要与之交互的后端的性质,我无法使用jqGrid提供的过滤器,而是需要在提交之前拦截搜索并修改postdata.我使用filterToolbar选项"beforeSearch"执行此操作,如下所示:

$("#SC_grid").jqGrid('filterToolbar', {stringResult: true, searchOnEnter: true, defaultSearch : "cn", beforeSearch: function() {
            var postData = $("#SC_grid").jqGrid('getGridParam','postData');
            var newPostData = '1=1';
            var searchData = jQuery.parseJSON(postData.filters);
            for (var iRule=0; iRule<searchData.rules.length; iRule++) {
                newPostData = newPostData + " AND " + searchData.rules[iRule].field + " LIKE '%" + searchData.rules[iRule].data + "%' ";
            }
            $("#SC_grid").jqGrid('setGridParam',{postData: { filter: newPostData, filters: ''} } );
            return false;
}});
Run Code Online (Sandbox Code Playgroud)

这对我来说非常适合在提交之前构建我的部分选择.我也想以相同的方式使用高级搜索,但无法弄清楚如何在提交之前拦截POST.似乎没有可用的beforeSearch()选项,并且afterShowSearch或onClose选项没有正确的时间.关于如何进行的任何建议?

标记

jquery jqgrid

5
推荐指数
1
解决办法
8762
查看次数

标签 统计

jquery ×2

fullcalendar ×1

jqgrid ×1