码迷,mamicode.com
首页 > 其他好文 > 详细

FineUI使用记录

时间:2019-11-03 18:35:09      阅读:286      评论:0      收藏:0      [点我收藏+]

标签:block   return   href   selected   scl   grid   add   push   bsp   

@{
ViewBag.Title = "Grid/Grid";
var F = Html.F();
}

@section body {

@(F.Grid().IsFluid(true).CssClass("blockpanel").Title("表格").ShowHeader(true).ShowBorder(true).ID("Grid1").DataIDField("SaleAfterDTID").DataTextField("SaleAfterDTID")
.Columns(
F.RowNumberField(),
F.RenderField().HeaderText("处理类别").DataField("DealType").Width(120),

F.RenderField().HeaderText("原因分类").DataField("ReasonClass").Width(200),

F.RenderField().Width(80).EnableHeaderMenu(false).RendererFunction("renderActions")

)
.DataSource(ViewBag.DataSource)
)
<br>
<br>

@(F.Button().Text("选中了哪些行").ID("Button1").Listener("click", "notifySelectedRows(‘Grid1‘);"))


@(F.Button().Text("新增一行").ID("Button2").Listener("click", "addRow();"))

}

 

@section script {

<script src="~/res/js/grid.js"></script>
<script>
var jsonData;
jsonData=eval(@Html.Raw(ViewBag.jsonData));
function jiang() {
alert("jiangyunfeng");
}
function renderActions(value, params) {
var deleteImageUrl = ‘@Url.Content("~/res/icon/delete.png")‘;
return ‘<a class="action-btn delete" href="javascript:;"><img class="f-grid-cell-icon" src="‘ + deleteImageUrl + ‘"></a>‘;
}

function addRow() {
var grid1 = F.ui.Grid1;

// 新增一行(返回新增行的ID)
var addDa = {

‘DealType‘: ‘前台添加的1‘,
‘ReasonClass‘: ‘前台添加的2‘
};
var addedRowId = grid1.addNewRecord(addDa, true);
addDa.rowIndex = addedRowId;
jsonData.push(addDa);
// alert(addedRowId);
}

F.ready(function () {
if (jsonData) {
var grid1 = F.ui.Grid1;
var gridData = grid1.getMergedData();
$.each(gridData, function (index, itme) {
jsonData[index].rowIndex = itme.id;
});
}

//alert(jsonData[1].ReasonClass);

//F.ui.btnSelectItem6.on(‘click‘, function () {
// alert(‘按钮的单击‘);
//});

//F.ui.DropDownList1.el.on(‘select‘, function () {
// alert(‘下拉的单击2‘);
//});

function getRowData(rowdata) {
alert(rowdata.id);
}

var grid1 = F.ui.Grid1;
grid1.el.on(‘click‘, ‘a.action-btn.delete‘, function (event) {
var cnode = $(this);
var rowData = grid1.getRowData(cnode.closest(‘.f-grid-row‘));

getRowData(rowData);
});
});

</script>
}

FineUI使用记录

标签:block   return   href   selected   scl   grid   add   push   bsp   

原文地址:https://www.cnblogs.com/jiangyunfeng/p/11788104.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!