[Dojo-interest] FilteringTable.clearData() wipes out my columns!

Tom Trenka dojo-interest at dept-z.com
Tue Feb 27 10:25:35 MST 2007


File this one in trac (http://trac.dojotoolkit.org/) please (assign to
ttrenka), and we'll see what happens.  We've got an aggressive schedule
ahead of us and it's starting to look like FilteringTable will not be in the
final Dojo widget release; it will be replaced by a real grid widget, and
we'll take all of these lessons into account when we develop it.

trt


dandv wrote:
> 
> Tom,
> 
> I had exactly the same problems as Erik, with the widget being created in
> the callback function,. Without searching nabble first (stupid me), I
> prepared a bug report at http://privatepaste.com/3f0qePMkr8. Apart from
> requests 2..n doubling the column data as Erik explained, I found 2 main
> issues if the widget was created from the callback function:
> 1. Why is it necessary to call g.columns = [] after creating the widget
> programatically, when columns should be void?
> 2. Why does clearData() prevent the headers from displaying, if
> clearData() is called before setting up the columns and the data?
> 
> Another issue I reproduced only with server-side code was that after the
> second request, sorting by clicking table headers threw an exception "o
> has no properties".
> 
> Erik, after I moved the widget creation,
>     dojo.addOnLoad(function() {
>         g = dojo.widget.createWidget("dojo:FilteringTable", {valueField:
> "id", alternateRows: true, multiple: true, maxSortable: 1},
> dojo.byId("grid"));
>     });
> I don't have any of these problems. I don't do reset, clearData, or
> .columns=[]. I only initialize the columns when the first data set
> arrives:
> 
> if (!g.columns[0]) {
>     for (var name in data.columns) {
>         g.columns.push(g.createMetaData({field: name, dataType:
> data.columns[name]}));
>     }
> }
> 
> Hope that helps,
> Dan Dascalescu
> 
> 
> Tom Trenka wrote:
>> 
>> Hmm.  I've no idea why your code is clearing out the headers; it
>> shouldn't be, and I've never seen that behavior before.
>> 
>> I *will* say that usually once you create the column definitions, they're
>> fixed/unalterable without destroying the widget and recreating it; and
>> doing that kind of thing is (IMHO) a bad idea.  I would suggest using one
>> instance of the widget for every data set you're expecting to see that
>> has different columns.
>> 
>> trt
>> 
> 

-- 
View this message in context: http://www.nabble.com/FilteringTable.clearData%28%29-wipes-out-my-columns%21-tf3245419.html#a9187272
Sent from the Dojo mailing list archive at Nabble.com.



More information about the Dojo-interest mailing list