function Grid_Edit() {
var rows = F('<% =Grid1.ClientID %>').f_getSelectedRows();
var id;
Ext.Array.each(rows, function (rowIndex, index) {
var rec = F('<% =Grid1.ClientID %>').store.getAt(rowIndex);
id = rec.get('ItemId');
});
F('<% =Window1.ClientID %>').f_show('./gridedit.aspx?id=' + id, '修改', 500, 300);
}
F.ready(function () {
Bindedit();
});
function Bindedit(Position) {
var activeWindow = F.wnd.getActiveWindow();
var id = activeWindow.window.GetSelectID(Position);
F.customEvent('Bindedit_' + id);
}
function GetSelectID(Position) {
var grid = F('<% =Grid1.ClientID %>');
var selectedValues = [];
var rows = grid.f_getSelectedRows(), id;
Ext.Array.each(rows, function (rowIndex, index) {
//上机制,到0了就上不去了
if (Position == "top" && rowIndex != 0) {
rowIndex = rowIndex - 1;
}
//到最后也上不去了
if (Position == "next" && rowIndex != grid.f_getPaging().f_pageSize - 1 && rowIndex != grid.getStore().getCount()) {
rowIndex = rowIndex + 1;
}
//想写翻页着,不好写
if (rowIndex == grid.f_getPaging().f_pageSize - 1) {
//F.customEvent('rowIndex_Next_');
}
//新方法:选择当前行
selectedValues.push(rowIndex);
grid.f_selectRows(selectedValues);
//得到行对应列的数据
var rec = grid.store.getAt(rowIndex);
id = rec.get('ItemId');
});
return id;
}