English 中文(简体)
Smartclient GWT making a ListGridRecord field editable using a custom DataSource
原标题:

We re using SmartClient GWT library (see the Smartclient GWT showcase here).

I m trying to make a ListGrid UI that when you click a record the fields become editable. Just like the example:

The difference is I m using my own custom GWT RPC services and manually adding ListGridRecord s to my own DataSource, and I see my records appear but the fields aren t editable when clicked. I ve created a custom DataSource using the GWTRPCDataSource implementation and properly override the executeFetch method.

Is there some special processing that s going on using the examples XML DataSource that creates ListGridRecords that properly set it up to be editable?

For example I m using the CountryXMLDS.java just like the example except I m adding one custom record (and I ve removed all fields but the population field that I want to be editable). I see my record appear but the field is NOT editable when the record is clicked.

    ListGridField populationField = new ListGridField("population", "population");
    populationField.setType(ListGridFieldType.INTEGER);
    populationField.setCanEdit(true);

   countryGrid.setFields( populationField);

    countryGrid.setCanEdit(true);
    countryGrid.setEditEvent(ListGridEditEvent.CLICK);


    ListGridRecord record = new ListGridRecord();
    record.setAttribute("population", "5");
    CountryXmlDS.getInstance().addData(record);
最佳回答

Whatever the problem is, it s not in the details you ve shared. Try these steps:

  1. make sure you re calling setDataSource() on the ListGrid with your DataSource

  2. make sure the name of your ListGrid field matches a field from the DataSource. This is case sensitive

  3. make sure you have a primaryKey declared in the DataSource. There s no way to save edits unless there s a way to identify records

  4. look for messages in the Developer Console

    http://forums.smartclient.com/showthread.php?t=8159#aConsole

  5. shotgun approach: override ListGrid.canEditCell() and return whatever you want - this overrides all the declarative settings like field.canEdit.

问题回答

暂无回答




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签