Results 1 to 8 of 8

Thread: creating new object of the class..

  1. #1

    Post creating new object of the class..

    Whot i hav done is that i have created a class of Gridpanel and i hav hard coded the store data with one array contents... Now the question is that if i create another object of that same class how can i change the store ->data contents by using the newly created object....


    please help...

    i am a new user to WTFJS....


    thank you

  2. #2
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    Code:
    grid.getStore().loadData(otherData);
    (but why hardcode data if you are planning on changing it later anyway)

  3. #3

    Default

    thanks a lot....

    i was trying to load new array content via creating new object...

    i mean new object created and then new array loaded into new grid and not in same grid...



    following is the code:

    Wtf.onReady( function() {
    //---------------------------------------------------------------------------------------------------------
    var myData=[
    ['Datta','Pimpri',123456789,411044],
    ['anwar','Nigdi',789456134,411055],
    ['Kapil','Warje',564567891,411033]
    ];//mydata

    var myData1=[
    ['abc','abc',123456789,411044],
    ['def','def',789456134,411055],
    ['pqr','pqr',564567891,411033]
    ];

    var myData2=[
    ['asd','asd',123456789,411044],
    ['yui','dghfh',789456134,411055],
    ['bnm','pqrhhh',564567891,411033]
    ];

    //----------------------------------------------------------------config
    Wtf.myGridpanel = function(config){

    Wtf.apply(this,config);

    this.newData=Wtf.data.Record.create([
    {name:'Name'},{name:'Address'},{name:'Phone'},{name:'Pin Code'}
    ]);

    this.store=new Wtf.data.Store({
    data:this.store1,
    reader:new Wtf.data.ArrayReader({root:'newData'},this.newData)
    });

    this.colModel = new Wtf.grid.ColumnModel([
    {header:'Name',width:120,sortable:true,dataIndex:'Name'},
    {header:'Address',width:120,sortable:true,dataIndex:'Address'},
    {header:'Phone',width:120,sortable:true,dataIndex:'Phone'},
    {header:'Pin Code',width:120,sortable:true,dataIndex:'Pin Code'}
    ]);

    this.cellSel=new Wtf.grid.CellSelectionModel();
    //--------------------------------------------------------------
    this.grid=new Wtf.grid.GridPanel({
    store:this.store,
    cm:this.colModel,
    // layout:'fit',
    width:500,
    renderTo:document.body,
    frame:true,
    stripRows:true,
    sm:this.cellSel
    });

    Wtf.myGridpanel.superclass.constructor.call(this,{items:this.grid});

    this.cellSel.on('cellselect',this.ShowSelected,this);

    };//myGridpanel close

    Wtf.extend(Wtf.myGridpanel,Wtf.Panel,{

    ShowSelected:function(){
    var x=this.cellSel.getSelectedCell();
    alert(x);
    }
    });


    //-------------------object creation-------------------------
    var myGridpanel=new Wtf.myGridpanel({
    renderTo:document.body,
    store1:myData,
    autoScroll:true,
    title:"My Grid Panel1",
    width:500,
    frame:true
    });

    var myGridpanel1=new Wtf.myGridpanel({
    renderTo:document.body,
    autoScroll:true,
    store1:myData1,
    title:"My Grid Panel2",
    width:500,
    frame:true
    });

    var myGridpanel1=new Wtf.myGridpanel({
    renderTo:document.body,
    autoScroll:true,
    store1:myData2,
    title:"My Grid Panel3",
    width:500,
    frame:true
    });


    //-------------------------------------------------------------
    });//onready

  4. #4
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    Quote Originally Posted by Dattaprasad View Post

    i am a new user to WTFJS....
    I like that name. I think I'm going to write a Javascript library and call it that!

  5. #5

    Default

    lol

    how cool is that!!!!

    it was miswritten....

    "EXTJS" it was...!!!

  6. #6
    Sencha User mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,232

    Default

    Quote Originally Posted by Animal View Post
    I like that name. I think I'm going to write a Javascript library and call it that!
    i think someone's already grabbed that name:
    http://wtfjs.com/

    (very interesting read though -- i highly recommend it)

  7. #7
    Sencha User
    Join Date
    Apr 2008
    Posts
    527

    Default

    Quote Originally Posted by mystix View Post
    i think someone's already grabbed that name:
    http://wtfjs.com/

    (very interesting read though -- i highly recommend it)
    Nice little site!! It's the right name for that

  8. #8

    Default

    as soon as i get a new name i'l surely suggest it to you....!!!


Similar Threads

  1. Creating extended class from large chunk of code
    By mmartinek in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 29 Oct 2009, 7:52 PM
  2. creating a generic form class using ext.extend
    By ismoore in forum Ext 2.x: Help & Discussion
    Replies: 10
    Last Post: 29 Jan 2009, 12:52 AM
  3. Problem in creating custom css class for toolbar and menu
    By vishnupriya in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 25 Jan 2008, 2:32 AM
  4. Regarding creating the store object using string
    By johnlicy in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 28 Nov 2007, 8:19 AM
  5. Creating a dynamic Record Object
    By kaps77 in forum Ext 1.x: Help & Discussion
    Replies: 8
    Last Post: 23 Aug 2007, 6:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •