
经常有小伙伴反馈:移动分录划到下面,删除一个分录后,分录会刷新,这样焦点就跳到了分录顶部,使用起来比较麻烦,那么如何通过二开实现无刷新删除呢?
直接上代码:
```csharp
using Kingdee.BOS.JSON;
using Kingdee.BOS.Mobile.Bill;
using Kingdee.BOS.Mobile.Metadata.EnitiyElement;
using Kingdee.BOS.Mobile.PlugIn;
using Kingdee.BOS.Mobile.PlugIn.ControlModel;
using Kingdee.BOS.Util;
using Kingdee.BOS.Web.DynamicForm;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
namespace Kingdee.BOS.Mobile.FormPlugIns.Test
{
[Description("测试单据分录")]
public class TestBillEntity : AbstractMobileBillPlugin
{
public override void ButtonClick(Core.DynamicForm.PlugIn.Args.ButtonClickEventArgs e)
{
switch (e.Key.ToUpper())
{
case "FDELETE":
var row = this.View.GetControl<MobileListViewControl>("FMobileProxyEntryEntity").GetFocusRowIndex();
var sourceEntryEntity = ((MobileProxyEntryEntity)this.View.BusinessInfo.GetEntity("FMobileProxyEntryEntity")).SourceEntryEntity;
int rowCount = this.View.BillModel.GetEntryRowCount(sourceEntryEntity.Key);
if (rowCount == 0) return;
this.View.BillModel.DeleteEntryRow(sourceEntryEntity.Key, row);
this.View.BillView.UpdateView(sourceEntryEntity.Key);
//this.View.UpdateView("FMobileProxyEntryEntity"); //直接刷新会导致,页面滚到分录顶部
string key = "FMobileProxyEntryEntity";
CallParameter callParam = new CallParameter()
{
//从1开始
methodname = "DeleteRows",
args = new object[] { row },
key = key.ToUpper()
};
this.View.AddAction("InvokeControlMethod", callParam);
break;
}
base.ButtonClick(e);
}
}
}
```