gpt4 book ai didi

smartgwt - 如何在 smartGwt ListGrid 中删除或添加行时更新数据库

转载 作者:行者123 更新时间:2023-12-02 04:07:11 31 4
gpt4 key购买 nike

    i want to delete the row from the grid...and changes should reflect
into my database..Please provide me some idea to do that...

The above code was later updated by me and i already added the data source in which i am initializing the fields. Updated code as follws
listgrid = new SigmaListGrid();
listgrid.setDataSource(screenDS);
return listgrid; public
SigmaListGrid() {
setShowFilterEditor(true);
setHeight100();
setWidth100();
setShowRecordComponents(true);
setShowRecordComponentsByCell(true);
setCanRemoveRecords(true);
setShowAllRecords(true);
setCanResizeFields(true);
setCanEdit(true);
setAutoSaveEdits(false);
}
}

===

公共(public)类 ScreenDataSource 扩展 TPDDataSource {
/**
* @param id
*/
public ScreenDataSource(String id) {
super(id);
initializeFields();
}

private void initializeFields() {

DataSourceField pkField = new DataSourceIntegerField(...
DataSourceField screenName = new DataSourceTextField(.....);
screenName.setCanEdit(true);

setFields(pkField, screenName;
}

@Override
public void clearData() {
// TODO Auto-generated method stub

}
/**
* This method will populate the data
* @param records
*/
public void setData(List<ScreenGridRecord> records) {
clearData();
for (ScreenGridRecord screenGridRecord : records) {
addData(screenGridRecord);
}
}


@Override
public void setData() {

}

}
Thanks @kimi ,i am adding a new row in list 
grid by listgrid.startEditingNew(); in newly added row i am inserting new data.Now i want to save the data @ server side .I also used listgrid.saveAllEdits(); but it is not working .

最佳答案

首先,您的 ListGrid 没有 DataSource在提供的代码中。 ListGrid 需要一个 DataSource 来进行数据绑定(bind)。

从用户界面的角度来看,鉴于您的 ListGrid 的数据源实现了所需的操作(addfetchupdateremove),从用户界面的角度来看,代码应该可以正常工作。我猜你没有正确设置数据源。

关于smartgwt - 如何在 smartGwt ListGrid 中删除或添加行时更新数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7027594/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com