PDA

View Full Version : Paging BeanModel Grid client update



zilaz
10 Jan 2011, 2:17 AM
Hi All,

I have a Paging BeanModel Grid with CheckBoxSelectionModel. I would like to update a column in the selected rows firing from a Button event. My problem is that the fields in the store are updated (I see in the log after update), but I do not see the changes in the grid.

Please help me,
zilaz

The grid:

service = (BusinessServiceAsync) Registry.get(JmsqHandlerEntryPoint.BUSINESS_SERVICE);
proxy = new RpcProxy<PagingLoadResult<JmsqHandlerModel>>() {
@Override
public void load(Object loadConfig,
AsyncCallback<PagingLoadResult<JmsqHandlerModel>> callback) {
service.getMessages((PagingLoadConfig) loadConfig, callback);
}
};

loader = new BasePagingLoader<PagingLoadResult<ModelData>>(
proxy, new BeanModelReader());
loader.setRemoteSort(true);

store = new ListStore<BeanModel>(loader);

toolBar = new PagingToolBar(50);
toolBar.bind(loader);

sm = new CheckBoxSelectionModel<BeanModel>();

columns.add(sm.getColumn());
columns.add(new ColumnConfig("messageId", "Message Id", 150));
columns.add(new ColumnConfig("destinationQueue", "Destination Queue", 200));
columns.add(new ColumnConfig("jmsType", "Jms Type", 100));
columns.add(new ColumnConfig("jmsTimeStamp", "Timestamp", 200));

cm = new ColumnModel(columns);

grid = new Grid<BeanModel>(store, cm);
grid.addListener(Events.Attach, new Listener<GridEvent<BeanModel>>() {

public void handleEvent(GridEvent<BeanModel> be) {
loader.load(0, 50);
}
});
grid.setSelectionModel(sm);
grid.setLoadMask(true);
grid.setBorders(true);
grid.setAutoExpandColumn("destinationQueue");
grid.addPlugin(sm);

gridContenPanel.setFrame(true);
gridContenPanel.setCollapsible(true);
gridContenPanel.setAnimCollapse(false);
gridContenPanel.setButtonAlign(HorizontalAlignment.CENTER);
gridContenPanel.setHeading("OPERATORS_ERROR_JMSQ");
gridContenPanel.setLayout(new FitLayout());
gridContenPanel.add(grid);
gridContenPanel.setSize(790, 350);
gridContenPanel.setBottomComponent(toolBar);
gridContenPanel.addButton(resendButton);
gridContenPanel.addButton(deleteButton);

The ButtonEvent:
private SelectionListener destinationQueueButtonListener() {
SelectionListener listener = new SelectionListener<ButtonEvent>() {

/**
*
*/
@Override
public void componentSelected(ButtonEvent ce) {
GWT.log(destinationQueueTF.getValue());
store.getModels().get(0).set("destinationQueue", destinationQueueTF.getValue());
GWT.log((String) store.getModels().get(0).get("destinationQueue"));
}
};

return listener;
}

sven
10 Jan 2011, 1:15 PM
What is JmsqHandlerModel? Please post that class here

zilaz
10 Jan 2011, 11:47 PM
This is the class:

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package jmsqHandler.model;

import com.extjs.gxt.ui.client.data.BeanModelTag;
import java.io.Serializable;

/**
*
* @author zilaz
*/
public class JmsqHandlerModel implements BeanModelTag, Serializable {

private String messageId;
private String jmsType;
private String jmsTimeStamp;
private String destinationQueue;
private String messsage;

public void setMessageId(String mId) {
messageId = mId;
}

public String getMessageId() {
return messageId;
}

public void setJmsType(String jType) {
jmsType = jType;
}

public String getJmsType() {
return jmsType;
}

public void setJmsTimeStamp(String jTimeStamp) {
jmsTimeStamp = jTimeStamp;
}

public String getJmsTimeStamp() {
return jmsTimeStamp;
}

public void setDestinationQueue(String destQueue) {
destinationQueue = destQueue;
}

public String getDestinationQueue() {
return destinationQueue;
}

public void setMesssage(String mess) {
messsage = mess;
}

public String getMesssage() {
return messsage;
}

/**
* Default toString method for show the all variables.
*
* @return
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
sb.append("messageId= ").append(getMessageId()).append(", ");
sb.append("jmsType= ").append(getJmsType()).append(", ");
sb.append("jmsTimeStamp= ").append(getJmsTimeStamp()).append(", ");
sb.append("destinationQueue= ").append(getDestinationQueue()).append(", ");
sb.append("messsage= ").append(getMesssage());
sb.append("}");

return sb.toString();
}
}

sven
11 Jan 2011, 12:43 PM
Try calling
store.update(store.getAt(0));