Grid refresh after save

Hi
I am using a editable ListGrid with bulk modification support
I used grid.saveAllEdits() to save the unsaved edits.
My proplem is
I need to update each rows after save with correct status colors..
Now the behaviour is after save the records showed in blue color ( Unsaved Edits color) .
Among the edited records some of them may be saved successfully and some may return validation messages..
But when i MouseOver the records the status colors have been updated for the records ( black for successful save and red for the validation errors)..

I need this status update defaultly after save and not after a mouse over or select.

Similarly for Delete also i need the updated list ( With validation errors ( on delete failure)or removed rows (on successful delete))

Is there a default configurations available to do this? Or
I need to write callback methods to do this ? If so can you give me a sample.

Thanks in advance. Waiting for a quick reply..

Hi rajadurai,

That refresh should be happening automatically. Questions:

  1. Do you see a JS error or any other error indication in the logs?

  2. What do you see during the save operation in the client-side logs if you enable the “ResultSet” log category?

  3. Your post was titled “Treegrid..” but you are talking about a ListGrid. Did you really mean a ListGrid?

I need validation mesage + refresh

Hi,
Thanks for the reply..
1) I don’t see any major JS errors in logs
2) I am talking about the List Grid ( I have changed the title already)

     I am using a ListGrid and a datasource XML for it.
    This XML contains the server object binding and i have implement the fetch ,add , update and remove methods in the server action class.

Current scenerio
As you told the ListGrid is automatically refreshed after save or edit.
The sigranture of my update method is

public Domain update(Domain domain)
	{
          ....
        // code to validate
        // code to update 
         return domain;
        }

In the above code Domain is my value object. I am returning the updated object to the cleient and its working fine…the List grid is updated

But if need to send some validation error message to the client what should i do now?

Actually if i am using a code like the following

public DSResponse update(Domain domain)
	{
          ....
        // code to validate
        DSResponse dsRespone = new DSResponse();
        dsRespone.setFailure();
    	dsRespone.addError("domain","Duplicate entry  for Domain");
 
         return dsRespone;
        }

In this case the validation message is sent to the client but the auto refresh doesn’t take place. If i move the mouse over the record then only the status is updated ( with red color for validation error)..

My need is
I will call the update method ,after save the listgrid should be refreshed with successfully saved record or failure message in the case of validation.. To achieve this what should be my method signature for this example..

Please help me

Hi
It looks like the reason validation errors are not showing up is that you’re using ‘setFailure()’ to set the status on the DSResponse object to STATUS_FAILURE rather than STATUS_VALIDATION_ERROR. Try calling setStatus() and passing in STATUS_VALIDATION_ERROR instead.

Let us know if this doesn’t fix it and we’ll take another look

Thanks
Isomorphic Software

still not working

Hi
I have done the same but still its not working..
In both the cases ( setFailure() or setStatus() ) the result is same.
Its giving the validation info ( the color change on field ) only after a ‘mouseover’ event on it.

      What should be my return type of the add/update methods ? thats the big question here.

Please help me..
Thanks
Rajadurai

Hi Rajadurai,
On the server you should only need to set the response status, set the errors, and send the response to the client via rpcManager.send()
The refresh on the client to show the error styling should be occurring automatically when the response comes back from the server with errors.

It would be possible to force a refresh (if you need a quick workaround, you can probably do this by passing ‘myGrid.markForRedraw()’ into the saveAllEdits() call as a callback), but we’d really like to get to the bottom of what’s going on here.
I think our best bet is to enable some logs and try to determine what’s happening on the client. I think it would also make sense to take this analysis offline (we can post the results in the forum when we have a conclusion).

In the developer console, could you set the following logs (under “Logging Preferences”) to “debug”:

Then load your application, make a modification that you know will cause a server error, and then trip the ‘saveAllEdits()’ call.

Then copy and paste the entire log session into an email to support@isomorphic.com and we’ll take a look.

Hopefully this will give us enough information to see what’s going wrong for you.

Thanks
Isomorphic Software

log information

Hi,
I have attched the log information.
I have problem with the validation messages alone.
The validation mesages are properly sent from the server response and i can see the validation message in the client( Only after mouse over to the record).
But i need this to show the validation messages automatically in the curresponding row.

Update method in server action file

  public DSResponse update(Domain domain)
            {          log.debug("-- In Domain Update Method --");
                        DSResponse dsResponse = new DSResponse();
                        try   {
                              // update code here --- updateDomain(domain);
                            }   catch (javax.ejb.EJBException e)     {    
//validation code here                                       dsResponse.setStatus(DSResponse.STATUS_VALIDATION_ERROR);
 dsResponse.addError("domain","Duplicate entry '" +domain.getDomain() +"' for Domain");
  dsResponse.setData (domain);
            }
        return dsResponse;
            }

log information

19:06:19.234:INFO:EventHandler:Target Canvas for event 'mousedown': [ImgButton ID:saveIcon]

19:06:19.281:DEBUG:EventHandler:Bubbling event 'prepareForDragging', target '[ImgButton ID:saveIcon]' has handler: Canvas.prepareForDragging()

19:06:19.328:DEBUG:EventHandler:Bubbling event 'prepareForDragging', target '[ToolStrip ID:toolBar]' has handler: Canvas.prepareForDragging()

19:06:19.375:DEBUG:EventHandler:Bubbling event 'prepareForDragging', target '[VLayout ID:headerArea]' has handler: Canvas.prepareForDragging()

19:06:19.421:DEBUG:EventHandler:Bubbling event 'prepareForDragging', target '[VLayout ID:pageLayout]' has handler: Canvas.prepareForDragging()

19:06:19.468:DEBUG:EventHandler:Event 'prepareForDragging' bubbled to top

19:06:19.531:DEBUG:EventHandler:No dragTarget, not dragging

19:06:19.578:INFO:ImgButton:saveIcon:call to deprecated setClassName() property - use setStyleName() instead

19:06:19.625:DEBUG:EventHandler:Event 'mouseDown' bubbled to top

19:06:19.687:DEBUG:EventHandler:Event 'mouseStillDown' bubbled to top

19:06:19.765:DEBUG:nativeFocus:onblur fired on: [GridRenderer ID:indexList_body], activeElement: isc_R

19:06:19.796:DEBUG:nativeFocus:onfocus fired on: [ImgButton ID:saveIcon], activeElement: isc_R

19:06:19.843:INFO:EventHandler:Target Canvas for event 'mouseup': [ImgButton ID:saveIcon]

19:06:19.890:INFO:ImgButton:saveIcon:call to deprecated setClassName() property - use setStyleName() instead

19:06:19.937:DEBUG:EventHandler:Event 'mouseUp' bubbled to top

19:06:20.000:DEBUG:gridEdit:indexList:change detection: newValues: {domainId: "3",

domain: 100}, oldValues: {dateModified: "2007-08-16 11:24:10.0",

domain: "3424",

domainId: "3",

comment: "gdf",

name: "fdfdsfds",

dateCreated: "2007-08-16 11:24:10.0"}

19:06:20.046:DEBUG:gridEdit:indexList:At field: domain applying validators: [

{type: "integerRange",

max: 10000,

min: 1,

errorMessage: "The value can only be from 1 to 10000",

resultingValue: 100,

dynamicErrorMessageArguments: Obj}

]

19:06:20.093:INFO:gridEdit:indexList:validateFieldValue, newValue: 100, passed validation: true, resultingValue: 100

19:06:20.140:DEBUG:gridEdit:indexList:change detection: newValues: {domainId: "3",

domain: 100}, oldValues: {dateModified: "2007-08-16 11:24:10.0",

domain: "3424",

domainId: "3",

comment: "gdf",

name: "fdfdsfds",

dateCreated: "2007-08-16 11:24:10.0"}

19:06:20.203:DEBUG:gridEdit:indexList:At field: domain applying validators: [

{type: "integerRange",

max: 10000,

min: 1,

errorMessage: "The value can only be from 1 to 10000",

resultingValue: 100,

dynamicErrorMessageArguments: Obj}

]

19:06:20.250:INFO:gridEdit:indexList:validateFieldValue, newValue: 100, passed validation: true, resultingValue: 100

19:06:20.296:INFO:gridEdit:indexList:Saving newValues '{domainId: "3",

domain: 100}'

19:06:20.343:DEBUG:DataSource:domain:Outbound DSRequest: {operationType: "update",

dataSource: "domain",

data: Obj,

operation: undef,

application: undef,

willHandleError: true,

showPrompt: false,

oldValues: Obj{name:fdfdsfds},

clientContext: Obj}

19:06:20.390:INFO:DataSource:domain:performDSOperation(update) 1 records, queuing

19:06:20.453:DEBUG:RPCManager:Using ActiveX XMLHttpRequest via constructor: MSXML2.XMLHTTP

19:06:20.500:INFO:DataSource:domain:operation: update submitted against DataSource domain, 2 ResultSets will be affected

19:06:20.562:INFO:RPCManager:sendQueue[7]: 1 RPCRequest(s); transport: xmlHttpRequest; target: http://localhost/isomorphic/IDACall?is_isc_rpc=true&isc_clientVersion=5.6&xmlHttp=true&iscTNum=7

19:06:20.640:DEBUG:RPCManager:Using ActiveX XMLHttpRequest via constructor: MSXML2.XMLHTTP

19:06:20.703:DEBUG:RPCManager:XMLHttpRequest POST to http://localhost/isomorphic/IDACall?is_isc_rpc=true&isc_clientVersion=5.6&xmlHttp=true&iscTNum=7 contentType: application/x-www-form-urlencoded; charset=UTF-8 with body -->_transaction=<transaction xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" xsi:type="xsd:Object"><transactionNum xsi:type="xsd:long">7</transactionNum><operations xsi:type="xsd:List"><elem xsi:type="xsd:Object"><where xsi:type="xsd:Object"><domainId>3</domainId></where><values xsi:type="xsd:Object"><dateModified>2007-08-16 11:24:10.0</dateModified><domain xsi:type="xsd:long">100</domain><domainId>3</domainId><comment>gdf</comment><name>fdfdsfds</name><dateCreated>2007-08-16 11:24:10.0</dateCreated></values><operationConfig xsi:type="xsd:Object"><dataSource>domain</dataSource><operationType>update</operationType></operationConfig><appID>builtinApplication</appID><operation>domain_update</operation><oldValues xsi:type="xsd:Object"><dateModified>2007-08-16 11:24:10.0</dateModified><domain>3424</domain><domainId>3</domainId><comment>gdf</comment><name>fdfdsfds</name><dateCreated>2007-08-16 11:24:10.0</dateCreated></oldValues></elem></operations></transaction>&protocolVersion=1.0<--

19:06:20.765:INFO:ImgButton:saveIcon:call to deprecated setClassName() property - use setStyleName() instead

19:06:20.859:DEBUG:EventHandler:Event 'click' bubbled to top

19:06:21.031:INFO:RPCManager:transaction 7 arrived after 406ms

19:06:21.078:DEBUG:RPCManager:Result string for transaction 7: "//isc_RPCResponseStart-->[

    {

        errors:[

            {

                domain:{errorMessage:"Duplicate entry '100' for Domain"}

            }

        ],

        invalidateCache:false,

        data:{comment:"gdf", domain:100, domainId:3, name:"fdfdsfds",

              dateModified:Date.parseServerDate(2007,7,17),dateCreated:Date.parseServerDate(2007,7,16)},

        endRow:0,

        status:-4,

        isDSResponse:true,

        totalRows:0,

        startRow:0

    }

]//isc_RPCResponseEnd"

19:06:21.125:INFO:RPCManager:rpcResponse(custom)[rpc]: [status=-4], result: object

19:06:21.171:INFO:gridEdit:indexList:error on save, status: -4, errors: [Obj

]

19:06:23.671:DEBUG:EventHandler:mousing out of [ImgButton ID:saveIcon]  mousing over [ToolStrip ID:toolBar]

19:06:23.734:DEBUG:Label:isc_Label_92:setRect: {left: -10000,

top: -1000,

width: undef,

height: undef}

19:06:24.140:DEBUG:nativeFocus:onblur fired on: [ImgButton ID:saveIcon], activeElement: isc_R

19:06:27.609:DEBUG:RPCManager:Using ActiveX XMLHttpRequest via constructor: MSXML2.XMLHTTP

19:06:27.703:INFO:RPCManager:sendQueue[8]: 1 RPCRequest(s); transport: xmlHttpRequest; target: alarm.do?is_isc_rpc=true&isc_clientVersion=5.6&xmlHttp=true&iscTNum=8

19:06:27.859:DEBUG:RPCManager:Using ActiveX XMLHttpRequest via constructor: MSXML2.XMLHTTP

19:06:27.968:DEBUG:RPCManager:XMLHttpRequest POST to alarm.do?is_isc_rpc=true&isc_clientVersion=5.6&xmlHttp=true&iscTNum=8 contentType: application/x-www-form-urlencoded; charset=UTF-8 with body -->_transaction=<transaction xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" xsi:type="xsd:Object"><transactionNum xsi:type="xsd:long">8</transactionNum><operations xsi:type="xsd:List"><elem

Thanks,
Rajadurai T

Hi Rajadurai
Thanks for the additional information. We’ve now been able to reproduce the problem in 5.6 (there was indeed a bug), and it is fixed for the upcoming 5.7 build.
If you need a workaround for 5.6, the trick of passing ‘myGrid.markForRedraw()’ into the saveAllEdits() call as a callback should work for you.

Regards
Isomorphic Software

Hi,
I have tried with markForRedraw() as you said. But even after this is not working as expected.
my client code

       indexList.endEditing();  
       indexList.saveAllEdits(indexList.getAllEditRows(),"indexList.markForRedraw()");

Log information

17:27:04.412:INFO:RPCManager:sendQueue[3]: 1 RPCRequest(s); transport: xmlHttpRequest; target: http://localhost/isomorphic/IDACall?is_isc_rpc=true&isc_clientVersion=5.6&xmlHttp=true&iscTNum=3
17:27:04.436:DEBUG:RPCManager:XMLHttpRequest POST to http://localhost/isomorphic/IDACall?is_isc_rpc=true&isc_clientVersion=5.6&xmlHttp=true&iscTNum=3 contentType: application/x-www-form-urlencoded; charset=UTF-8 with body -->_transaction=<transaction xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" xsi:type="xsd:Object"><transactionNum xsi:type="xsd:long">3</transactionNum><operations xsi:type="xsd:List"><elem xsi:type="xsd:Object"><where xsi:type="xsd:Object"><domainId xsi:type="xsd:long">43</domainId></where><values xsi:type="xsd:Object"><comment></comment><domain xsi:type="xsd:long">107</domain><domainId xsi:type="xsd:long">43</domainId><name>Domain002</name><dateModified xsi:type="xsd:date">2007-08-18</dateModified><dateCreated xsi:type="xsd:date">2007-08-18</dateCreated></values><operationConfig xsi:type="xsd:Object"><dataSource>domain</dataSource><operationType>update</operationType></operationConfig><appID>builtinApplication</appID><operation>domain_update</operation><oldValues xsi:type="xsd:Object"><comment></comment><domain xsi:type="xsd:long">107</domain><domainId xsi:type="xsd:long">43</domainId><name>Domain0033</name><dateModified xsi:type="xsd:date">2007-08-18</dateModified><dateCreated xsi:type="xsd:date">2007-08-18</dateCreated></oldValues></elem></operations></transaction>&protocolVersion=1.0<--
17:27:04.527:INFO:RPCManager:transaction 3 arrived after 106ms
17:27:04.556:DEBUG:RPCManager:Result string for transaction 3: "//isc_RPCResponseStart-->[
    {
        errors:[
            {
                name:{errorMessage:"hh Duplicate entry 'Domain002' for Name"}
            }
        ],
        invalidateCache:false,
        data:{comment:null, domain:107, domainId:43, name:"Domain002", 
              dateModified:Date.parseServerDate(2007,7,18),dateCreated:Date.parseServerDate(2007,7,18)},
        endRow:0,
        status:-4,
        isDSResponse:true,
        totalRows:0,
        startRow:0
    }
]//isc_RPCResponseEnd"
17:27:04.603:INFO:RPCManager:rpcResponse(custom)[rpc]: [status=-4], result: object
I have also tried with giving a simple alert statement as callback... This alert is being called only in the case of successful save and not during the validataion failure message from server. 
   If this is the behaviour of callback  then the markforredraw() will also be called after 

successful save or not..?
Can you clear me.? Help me to find out what might went wrong with us?

Thanks,
Rajadurai T.

Hi
Sorry for the confusion on this. Yes - as you discovered the callback for saveAllEdits() is a “save” callback - it only fires on successful save, which means it won’t work for this purpose of refreshing the grid to show errors. Our mistake for not checking the workaround more carefully before posting it.

As we said - this bug is definitely fixed in the 5.7 release. We currently have a Release Candidate 5.7 build available to certain developers, and the 5.7 final release should be available very shortly. If you can hold on until 5.7 this problem will just go away. If not let us know and we can come up with a patch that will fix the problem in 5.6

Thanks
Isomorphic Software

Hi,
Thanks for the reply and the conclusion. I will be happy if this will be fixed in 5.7
release.

Thanks,
Rajadurai T