0

My client side code is as follows where I am sending some data to the server to just print out the output. But when it returns from the server I get a empty listgrid record. what is the cause for this.

Here is the screen shot of the issue

enter image description here

if (fieldName.equals("Approve"))
{
IButton button = new IButton();
button.setHeight(18);
button.setWidth(65);
button.setTitle("Approve");
button.addClickHandler(new ClickHandler()
{
    public void onClick(ClickEvent event)
    {
        DebugTools.print("SOID " + record.getAttribute("supplierOrderID") + " SODID" + record.getAttribute("sodID")+" sordID "+record.getAttribute("sordID"));
        approveProduct(record.getAttribute("supplierOrderID"), record.getAttribute("sodID"),record.getAttribute("sordID"));
    }

private void approveProduct(String supplierOrderID, String sodID, String sordID)
{
    Record record = new Record();
                                record.setAttribute("supplierOrderID", supplierOrderID);
                                record.setAttribute("sodID", sodID);
                                record.setAttribute("sordID",sordID);
                                historyGrid.addData(record, callback);

}

          DSCallback callback = new DSCallback()
{
    @Override
    public void execute(DSResponse response, Object rawData, DSRequest request)
    {
        Record[] records = response.getData();

        if (records != null && records.length > 0)
        {
                             Record record = records[0];
                             JavaScriptObject js = record.getJsObj();                            JSONObject json = new JSONObject(js);                          System.out.println("  records.length    " + records.length);                    for (int i = 0; i < records.length; i++)    {                       Record recordd = records[i];
                                            JavaScriptObject jss = recordd.getJsObj();
                                            JSONObject jsonn = new JSONObject(jss);
                                            System.out.println(jsonn.toString());
                                        }
                                    }
                                }
                            };

and on the server side my add method is very simple for now where I am just printing the data I received from the client

public DSResponse add(DSRequest dsRequest) throws Exception
{
    DSResponse dsResponse = new DSResponse();
    Long user_idlong = SessionUtills.getSessionUser(dsRequest.getHttpServletRequest());

    System.out.println("sodID       " + dsRequest.getFieldValue("sodID").toString());
    System.out.println("PRODUCT APPROVED !!!!!!!!!!!!!" + " SUPPLIER ORDER ID " + dsRequest.getFieldValue("supplierOrderID").toString());
    return dsResponse;

}

I have also attached the shot of the issue

4

1 回答 1

0

问题出在服务器端,您从那里向客户端发送空文件DSResponse,因此在客户端,您将获得零长度记录数组。

DSResponse返回一个包含新添加记录的所有信息的valid 。


请看一下

必读处理 DataSource 请求的基本逻辑流程

于 2014-04-26T11:03:51.403 回答