> Yes, the critical call which makes it work in your last example is the
> dataProvider.setList() .
>
> This seems to me to be unintuitive because the whole notion of a
> provider and view is that when your model changes, the provider is
> informed and updates the views accordingly. Here not only does the
> provider have to be reconnected to a model by setList() , severing
> connection with the previous model (which means it has to redraw rows
> that haven't changed), but the CellTable itself has to be notified
> individually.
>
> There might be no mechanism currently in the provider to test for row
> data changes, but the way the user has to call this API seems to me to
> be all wrong.
>
> I guess we leave this here. Thanks for your help.
I was looking at this code a few days ago. I don't remember if I
referenced the following from the CellTable javadoc
It turns out that the important step to invalidating THE SAME CELL is
the clearViewData() call, not the dataProvider.setList() call.
/*
* Clear the view data. The view data contains the pending change and
* allows the table to render with the pending value until the data is
* committed. If the data is committed into the object, the view data
* is automatically cleared out. If the data is not committed because
* it is invalid, you must delete.
*/
nameCell.clearViewData(KEY_PROVIDER.getKey(object));
>
> On Aug 23, 5:38 pm, Jeffrey Chimene<jchim...@gmail.com> wrote:
>> On 8/23/2011 8:33 AM, Jeffrey Chimene wrote:
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>> On 8/23/2011 8:19 AM, Jeffrey Chimene wrote:
>>>> On 8/23/2011 2:38 AM, jsg wrote:
>>>>> Let me get this straight, you run the code in dev mode, you set the
>>>>> endTime TextInputCell to a value, let's say 14:18 and on pushing Enter
>>>>> or leaving focus, the code parses the value and updates it to 15:19
>>>>> (as the + 1 is set in the FieldUpdater) and then this displays
>>>>> immediately on your machine??
>>>> Yes.
>>>> In fact, there are other actions that can occur after pressing enter.
>>>> For example, the user could choose to delete a row in the table.
>>>> You can review the code athttp://code.google.com/p/gwt-sked, or try
>>>> out the project athttp://jchimene.com/sked.htmlThe specific example
>>>> you cite can be demonstrated by the following actions:
>>>> 0) Select "Load sample schedule" under the "Help"menu"
>>>> 1) Click a cell in the "Likely" column for a specific activity
>>>> 2) Set the value to zero. Press enter to blur the cell. Notice the
>>>> adjacent cell values are set to zero.
>>>> 3) Enter a non-zero value in the "Likely" cell. Press Enter to blur
>>>> the cell, the other cells are immediately updated.
>>>> I'm happy to supply annotations or answer questions.
>>>> You might have already done this, but try compiling the code in
>>>> PRETTY mode and run it using a browser that will display the
>>>> Javascript console (I usually use Firefox + Firebug). See if you have
>>>> any "interesting" runtime errors.
>>> Thinking further on your question, it occurs to me that you're asking:
>>> "how do I update THE SAME CELL". I have to admit this caused some
>>> consternation. For a while, I considered sub-classing EditTextCell, an
>>> approach I abandoned as unworkable.
>>> The Predecessor column implements this same cell update behavior to
>>> correct data entry errors that might introduce a network cycle. The
>>> apropos code is in "ActivityPresenter.onPredecessorChange()"
>>> Demonstrate as follows:
>>> 0) Select "Load sample schedule" under the "Help"menu"
>>> 1) Click a cell in the "Predecessor" column for a specific activity
>>> 2) Enter a comma-separated list that includes that row's ID. For
>>> example, if you choose activity "C",enter the string "1,3" as that
>>> activity's predecessor list. Press enter to blur the cell. Notice that
>>> the string ",3" is removed from the value.
>> The action sequence is:
>> 0) Update the Data Provider list:
>> dataProvider.setList(new ArrayList<Activity>(scheduler.getValues()));
>> dataProvider.flush(); //Maybe not needed?
>>
>> 1) Update the view
>> cellTable.setRowData(list);
>> cellTable.redraw();
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment