<div class="current-location">
    <ul>
        <li class="left"><i class="glyphicon glyphicon-home"></i><a href="javascript:void(0)" onclick="location.href=location.href">站内信息</a></li>
        <li class="right"><a href="javascript:void(0)" onclick="LoadData()" title="刷新"><span class="glyphicon glyphicon-refresh"></span></a></li>
    </ul>
</div>
<div class="main">
    <table class="tb-head" cellpadding="0" cellspacing="0" border="0">
        <tr>
            <td class="btn-group btn-group-sm">
                <button type="button" class="btn btn-default ui-selectInvert">反选</button>
                <div class="btn-group btn-group-sm">
                    <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                        菜单<span class="caret"></span>
                    </button>
                    <ul class="dropdown-menu" role="menu">
                        <li><a class="ui-dialog" href="javascript:void(0)" data-custom-params="title:'发送信息',url:'@Url.Action("Add")'">发送信息</a></li>
                        <li class="divider"></li>
                        <li><a class="ui-dialog" href="javascript:void(0)" data-custom-params="title:'分类管理',url:'@Url.Action("Index","MsgCategory")',width:'90%',height:'90%'">分类管理</a></li>
                        <li class="divider"></li>
                        <li><a href="javascript:void(0)" class="ui-deleteMultiple" data-custom-params="url:'@Url.Action("Delete")',callBack:'LoadData'">删除</a></li>
                    </ul>
                </div>
            </td>
            <td align="right">
                <div class="control-group">
                    <div class="controls form-inline form-group-sm">
                        <select name="categoryId" id="categoryId" class="form-control ui-queryString">
                            <option value="">所有分类</option>
                        </select>
                        <select class="form-control ui-queryString ui-setName" style="width:120px;">
                            <option value="title">标题</option>
                            <option value="username">发件人</option>
                            <option value="thedate" valuetype="date" searchtype="range">日期</option>
                        </select>
                        <input type="text" style="width:120px" placeholder="搜索关键词" class="form-control ui-keyword ui-queryString">
                        <button type="button" class="btn btn-default btn-sm ui-queryString-search">确定</button>
                    </div>
                </div>
            </td>
        </tr>
    </table>
    <table border=0 cellpadding=0 cellspacing=0 class="table table-bordered" id="tb_list">
        <thead>
            <tr>
                <td align="center" width="30px"><input type="checkbox" title="选择" class="ui-selectInvert" data-custom-params="isReverse:false"></td>
                <td>标题</td>
                <td align="center">分类</td>
                <td align="center">发件人</td>
                <td align="center">时间</td>
                <td align="center">操作</td>
            </tr>
        </thead>
        <tr class="item list-template-item" id="item_{id}">
            <td align="center">
                <input type="checkbox" value="{id}" class="checked-item">
            </td>
            <td align="left" width="50%"><span class="sp_title">{title}</span></td>
            <td align="center"><span class="lb_category text-gray">{categoryId}</span></td>
            <td align="center">{username}</td>
            <td align="center">{thedate}</td>
            <td align="center">
                <div class="btn-group btn-group-sm">
                    <input type="hidden" name="id" value="{id}" />
                    <button type="button" data-custom-params="title:'编辑',url:'@Url.Action("Edit")?id={id}'" class="btn btn-default btn-sm ui-dialog">修改</button>
                    <button type="button" class="btn btn-default btn-sm ui-deleteSingle ui-deleteSingle-{sysField}" data-custom-params="url:'@Url.Action("Delete")',callBack:'LoadData'">删除</button>
                </div>
            </td>
        </tr>
    </table>
</div>

<script type="text/javascript">
    var $categoryId = $("#categoryId");
    $categoryId.SelectBind({ url: "@Url.Action("ListData", "MsgCategory")", async:true})

    function LoadedInit() {
        $(".lb_category").ConvertText({ url: "@Url.Action("GetFieldByIds", "MsgCategory")", emptyStr: '--' });
        //$(".sp_title").each(function () {
        //    var $this = $(this);
        //    $this.text($this.text().Left(50));
        //});
    }

    function LoadData() {
        var url = "@Url.Action("PageListData")";
        $("#tb_list").ListBind({ url: url, callBack: "LoadedInit" });
    }
    LoadData();

</script>
