我在任何瀏覽器中都使用Smart GWT 2.3.0。智能GWT不會更新列表網格中的ID
我有一個listgrid只有數據簡單。當我創建新的註冊時,它不會更新我的ID。
我讀了faq problem關於這一點,我想我有一切正確。
數據源的代碼是:
DataSource ds = null;
try {
ds = new DataSource();
ds.setDataURL("do");
ds.setController(controller);
DataSourceTextField nombre = new DataSourceTextField("nombre",
"Nombre", 50, true);
DataSourceTextField codigo = new DataSourceTextField("codigo",
"Código", 50, true);
DataSourceTextField id = new DataSourceTextField("id",
"Identificador", 50);
id.setPrimaryKey(Boolean.TRUE);
id.setCanEdit(Boolean.FALSE);
ds.setFields(id, codigo, nombre);
控制檯的結果是:在
16:43:29.808:KPR3:DEBUG:gridEdit:isc_ListGrid_1:showing
內編輯器:3,2,將重點: 真 16時43: 31.385:KPR5:INFO:gridEdit:isc_ListGrid_1:cellEditEnd: 結束編輯,完成事件: 輸入 16:43:31.386:KPR5:DEBUG:gridEdit:isc_Li stGrid_1:變化 檢測:newValues:{codigo: 「PRUEBA」, NOMBRE: 「Prueba」},oldValues:是undef 16:43:31.390:KPR5:DEBUG:gridEdit:isc_ListGrid_1:在 字段:codigo施加驗證: [ {類型: 「isString」, typeCastValidator:真, _generated:真, defaultErrorMessage: 「必須是一個字符串。」}, {類型: 「需要」, defaultErrorMessage:是undef, 的errorMessage:「字段是要求「} ] to value:PRUEBA 16:43:31.390:KPR5:INFO:gridEdit:isc_ListGrid_1:validateFieldValue, newValue:」PRUEBA「,通過驗證: 真,resultingValue:空 16:43:31.392:KPR5:DEBUG:gridEdit:isc_ListGrid_1:在 字段:NOMBRE施加驗證:[ {類型: 「isString」, typeCastValidator:真, _generated:真, defaultErrorMessage : 「必須是一個字符串。」}, {類型: 「需要」, defaultErrorMessage:是undef, 的errorMessage: 「字段是必需的」} ]到值:Prueba 16:43:31.393:KPR5:INFO:gridEdit :isc_ListGrid_1:validateFieldValue, newValue:「Prueba」,通過驗證: true,resultsValue:null 16:43:31.393:KPR5:INFO:gridEdit:isc_ListGrid_1:保存 newValues '{codigo: 「PRUEBA」, NOMBRE: 「Prueba」}' 16:43:31.996:XRP3:DEBUG:結果集:isc_ResultSet_1 (創建: isc_ListGrid_1):數據源數據 改擊發 16時43分:31.997:XRP3:INFO:ResultSet:isc_XDataSource_3:dsResponse 對於類型add 的成功操作未返回更新的記錄[s]。 使用提交的請求數據更新 ResultSet緩存。 16:43:31.997:XRP3:DEBUG:結果集:isc_XDataSource_3:提交 數據被集成到所述高速緩存:[ {codigo: 「PRUEBA」, NOMBRE: 「Prueba」} ] 16:43:31.997: XRP3:INFO:ResultSet:isc_ResultSet_1 (由:isc_ListGrid_1創建):更新 緩存在operationType後面: add,allMatchingRowsCached true 16:43:31。997:XRP3:INFO:結果集:isc_ResultSet_1 (創建:isc_ListGrid_1):更新 緩存:operationType '添加' 由 'isc_ListGrid_1',提交 1行更新 數據: [ {codigo: 「PRUEBA」, 農佈雷: 「Prueba」} ] 16:43:31.998:XRP3:INFO:結果集:isc_ResultSet_1 (創建:isc_ListGrid_1):應用於本地 濾波器:4個記錄4匹配 濾波器:{ } 16時43分: 31.999:XRP3:信息:ResultSet的:isc_XDataSource_3:類型的成功運作dsResponse 添加 沒有返回更新的記錄[S]。 使用提交的請求數據更新 ResultSet緩存。 16:43:31.999:XRP3:DEBUG:結果集:isc_XDataSource_3:提交 數據被集成到所述高速緩存:[ {codigo: 「PRUEBA」, NOMBRE: 「Prueba」} ] 16:43:32.004: RDQ5:DEBUG:ResultSet的:isc_ResultSet_1 (創建人: isc_ListGrid_1):getRange(0,3) 從高速緩存
對不起,我忘了說,它發生在插入相同的,這是插入日誌:
13:22:09.162:KPR3:DEBUG:gridEdit:isc_ListGrid_0:change detection: newValues: {codigo: "prueba",
nombre: "prueba"}, oldValues: undef
13:22:09.167:KPR3:DEBUG:gridEdit:isc_ListGrid_0:At field: codigo applying validators: [
{type: "isString",
typeCastValidator: true,
_generated: true,
defaultErrorMessage: "Debe ser una Cadena."},
{type: "required",
defaultErrorMessage: undef,
errorMessage: "Campo es obligatorio"}
] to value:prueba
13:22:09.168:KPR3:INFO:gridEdit:isc_ListGrid_0:validateFieldValue, newValue: "prueba", passed validation: true, resultingValue: null
13:22:09.170:KPR3:DEBUG:gridEdit:isc_ListGrid_0:At field: nombre applying validators: [
{type: "isString",
typeCastValidator: true,
_generated: true,
defaultErrorMessage: "Debe ser una Cadena."},
{type: "required",
defaultErrorMessage: undef,
errorMessage: "Campo es obligatorio"}
] to value:prueba
13:22:09.172:KPR3:INFO:gridEdit:isc_ListGrid_0:validateFieldValue, newValue: "prueba", passed validation: true, resultingValue: null
13:22:09.172:KPR3:INFO:gridEdit:isc_ListGrid_0:Saving newValues '{codigo: "prueba",
nombre: "prueba"}'
13:22:10.612:XRP7:DEBUG:ResultSet:isc_ResultSet_0 (created by: isc_ListGrid_0):dataSource data changed firing
13:22:10.612:XRP7:INFO:ResultSet:isc_XDataSource_1:dsResponse for successful operation of type add did not return updated record[s]. Using submitted request data to update ResultSet cache.
13:22:10.612:XRP7:DEBUG:ResultSet:isc_XDataSource_1:Submitted data to be integrated into the cache:[
{codigo: "prueba",
nombre: "prueba"}
]
13:22:10.613:XRP7:INFO:ResultSet:isc_ResultSet_0 (created by: isc_ListGrid_0):updating cache in place after operationType: add, allMatchingRowsCached true
13:22:10.613:XRP7:INFO:ResultSet:isc_ResultSet_0 (created by: isc_ListGrid_0):Updating cache: operationType 'add' submitted by 'isc_ListGrid_0',1 rows update data:
[
{codigo: "prueba",
nombre: "prueba"}
]
13:22:10.614:XRP7:INFO:ResultSet:isc_ResultSet_0 (created by: isc_ListGrid_0):Local filter applied: 3 of 3 records matched filter:{
}
13:22:10.615:XRP7:INFO:ResultSet:isc_XDataSource_1:dsResponse for successful operation of type add did not return updated record[s]. Using submitted request data to update ResultSet cache.
13:22:10.615:XRP7:DEBUG:ResultSet:isc_XDataSource_1:Submitted data to be integrated into the cache:[
{codigo: "prueba",
nombre: "prueba"}
]
13:22:10.627:RDQ9:DEBUG:ResultSet:isc_ResultSet_0 (created by: isc_ListGrid_0):getRange(0, 2) satisfied from cache
這是送我的服務器JSON作爲響應添加新的寄存器:
input: {
"__requestBody": {
"dataSource": "isc_XDataSource_1",
"operationType": "add",
"data": {
"nombre": "prueba",
"codigo": "prueba"
},
"componentId": "isc_ListGrid_0",
"oldValues": null
},
"inputfields": [
{
"value": "prueba",
"property": "nombre"
},
{
"value": "prueba",
"property": "codigo"
}
],
"__requestFormat": "smartgwt",
"__httpSession": "[email protected]",
"__http_request": "[email protected]",
"fields": [
{
"name": "id",
"property": "id"
},
{
"name": "codigo",
"property": "codigo"
},
{
"name": "nombre",
"property": "nombre"
}
]
}
這是我更新寄存器的響應:
{
"id": "1",
"__requestBody": {
"dataSource": "isc_XDataSource_2",
"operationType": "update",
"data": {
"nombre": "prueba2",
"id": "1"
},
"componentId": "isc_ListGrid_0",
"oldValues": {
"id": "1",
"codigo": "prueba",
"nombre": "prueba"
}
},
"inputfields": [
{
"value": "prueba2",
"property": "nombre"
},
{
"value": "1",
"property": "id"
}
],
"__requestFormat": "smartgwt",
"__httpSession": "[email protected]",
"__http_request": "[email protected]",
"fields": [
{
"name": "id",
"property": "id"
},
{
"name": "codigo",
"property": "codigo"
},
{
"name": "nombre",
"property": "nombre"
}
]
}
這將是很好,看看從你的服務器響應的樣子。你能否用這些信息更新你的帖子? SmartGWT不會爲您創建任何ID,您將不得不自己提供它們。注意:如果您的回覆爲JSON格式,則還需要將數據源的DataFormat設置爲JSON。 – 2011-03-22 13:50:36
好吧,我用我的json服務器發送更新。 – user670852 2011-03-22 14:47:42