~ideamonk/sahana-eden/gsoc

« back to all changes in this revision

Viewing changes to static/scripts/S3UI/core.js

  • Committer: ideamonk
  • Date: 2010-08-16 20:22:10 UTC
  • Revision ID: abhishekmishra@mbp.local-20100816202210-pt3ya3qt2b1pbiym
unstable - data_createFields2 complete, no need of header dicts from backend now, everything fetched through json, grid creations is now callback based due to sync needed in fetching fields, column model generated in right way, so as for grid view, now the backend mostly has to do nothing as seen in xrc_list(), fixed root elements selection issue, now propagating change to _s3xrc_list.html

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
        errorColor: "#ffbbbb",  // background for invalid update rows
31
31
        rheader: undefined,     // stores DOMified rheader for further use
32
32
        resource_title: "",     // title to be used on create/update popup forms
 
33
        column_model: [],// columns for grid, now not from backend
33
34
 
34
35
        /* --------------------------------------------------------------------
35
36
            Data Transport functions
52
53
 
53
54
            if (component!=""){
54
55
                this.component_element = component;
55
 
                root_element = root_element+"[0]."+component;
 
56
                this.root_element = root_element+"[0]."+component;
56
57
            }
57
58
        },
58
59
        
266
267
            console.log("list", list);
267
268
            var item;
268
269
            for (i=0; i<list.length; i++){
269
 
                item={};
 
270
                item=list[i];
270
271
                if (list[i].type == "boolean"){
271
272
                    item.is_bool=true;
272
273
                }
286
287
            console.log("prepared ", this.list_fields);
287
288
        },
288
289
        
289
 
        data_createFields2: function(url, callback){
 
290
        data_createFields2: function(url, callback, failback){
290
291
            /* new and improved, doesn't cause any unREST and kills the reason
291
292
                for list_field hack to exist */
292
293
            var _parent = this;
303
304
                            var element = {};
304
305
                            element.name = f["@name"];
305
306
                            element.type = f["@type"];
 
307
                            element.label = f["@label"];
306
308
                            element.has_options = f["@has_options"];
307
309
                            if (element.name != "id"){
308
310
                                filtered_list.push(element);
491
493
            }
492
494
            return newColumn;
493
495
        },
 
496
        
 
497
        tools_getColumnModelFromList: function(){
 
498
            var colList=[];
 
499
            var elem;
 
500
            var _parent = this;
 
501
            Ext.each(this.list_fields, function(l){
 
502
                console.log(l);
 
503
                elem = _parent.tools_getColumnModel(
 
504
                    l["label"],
 
505
                    l["name"],
 
506
                    l["type"],
 
507
                    l["has_options"],
 
508
                    l["writable"]
 
509
                );
 
510
                _parent.column_model.push(elem);
 
511
            });
 
512
            console.log("injected",  _parent.column_model);
 
513
        },
494
514
 
495
515
        tools_getPagingCombo: function(){
496
516
            var pagingCombo = new Ext.form.ComboBox({
679
699
                    // this._parent.plugins.push(this._parent.widgets_rowEditor);
680
700
                    // ^ temporary disabled to test glitchless ui
681
701
 
 
702
                    this.column_model = this._parent.column_model;
682
703
                    // augument column model with actions
683
704
                    this.column_model.push(this._parent.tools_getRowAction());
684
705