[CLOSED] DataBound null on Grid Store

  1. #1

    [CLOSED] DataBound null on Grid Store

    I have a grid with a store. The store is normally loaded by copying items from another grid (and this works perfectly with JavaScript). However, I am writing functionality for users to save a workset with their selections, and another function for loading saved worksets into the grids.

    In the latter function (loading saved worksets), I have multiple grids and so multiple List<SomeObject> properties of the workset object. But I am having a problem with the data store behind one of the grids: the "data" attribute is null and the "databound" attribute is null, with a datasource which contains items, after assigning a data source and data binding:

    This is a stub of the workset object logic:

    //In a class file
    
    public class MyWorksetObject
    {
        public int MyWorksetObjectID  {get; set;}
        public  DateTime MyWorksetObjectDate  {get; set;}
        public MyItemList MyWorksetObjectItems  {get; set;}
        public MyTaskList MyWorksetObjectTasks {get; set;}
        
        public MyWorksetObject() {}
        public MyWorksetObject(int myWorksetObjectID) 
        {
            MyWorksetObjectID = myWorksetObjectID;
        }
        
        Load()
        {
            //Lots of things done
        }
    }
    public class MyTaskList  : List<MyTask>()
    {
        public MyTaskList ReturnTestVector()
        {
            MyTaskList  newTestVector = new MyTaskList ();
            newTestVector.Add(new MyTask(1, "First Task"));
            newTestVector.Add(new MyTask(2, "Second Task"));
            newTestVector.Add(new MyTask(3, "Third Task"));
            return newTestVector ;
        }
    }


    And this is a stub of the Workset loading logic:

    
    //In code behind of page
    [DirectMethod]
    public void MyWorkset_Load()
    {
        int myWorksetObjectID = 1; //Test vector ID 
        MyWorksetObject myWorkset = new MyWorksetObject(myWorksetObjectID);
        myWorkset.Load();
        
        MyGrid.GetStore().DataSource = myWorkset.MyWorksetObjectTasks;
        //In the debugger, MyWorksetObjectTasks has a count of 3.
        
        MyGrid.GetStore().DataBind(); 
        //In the debugger, the MyGrid object says the data source has a count of 3, 
        // but .data is null and .DataBound is null.
        
        MyGrid.DoLayout();
    }
    Is there something fundamental I'm missing about how to bind this grid store from the code behind? I'm using a pageproxy on the store.

    Thanks!

    Patrick
    Last edited by Daniil; Apr 22, 2014 at 8:27 PM. Reason: [CLOSED]
  2. #2
    DataBind doesn't update Data property, it is separate property is not related with DataBind
    Also DataBound is event, i am not sure why do you check it.

    Can you explain what exactly do you try to accomplish?
  3. #3
    Thanks, Vladimir.

    Sorry, that's my misunderstanding on those two properties. As I said, I am trying to bind the loaded object to the grid, and I'm using a DirectMethod.

    The idea is that items are copied from one grid to another, via JavaScript. That code is not represented in this thread, but it works fine (in part thanks to help from you, Daniil, and other folks at Ext.NET and on the forums). When the grid is completed, the user can run a report. If the user wants to work on the report in the future, the contents of this grid (and a couple of other grids) can be saved. Later, I want the user to be able to reload previous worksets - there is one large object that has several properties which are of types that inherit from List<> (each is stored in a separate table), and each such object represents the contents of one grid.

    What I'm trying to show is that I'm trying to load the contents of one of the properties into one of the grids.

    I'm not getting anything in the grid.

    There's probably something I'm doing wrong here, but I'm not sure what it is.

    I've set AutoDestroy to false, and AutoLoad to false.

    Patrick
  4. #4
    Sorry, but I still do not understand your issue correctly
    You have initial data which you bind to DataSource. Why do not use that data?

    I want the user to be able to reload previous worksets
    Just set data to DataSource again and call DataBind

    What exactly do you expect in the grid after DataBind calling?
  5. #5
    Sorry, Vladimir; I think I'm adding too much extraneous detail to my questions.

    I've got Ext.NET doing what I want it to do. The problem is that I still haven't figured out why it wasn't working before / is working now.

    Is there a significant difference between the
    myStore.LoadData();
    command and the pairing of
    myStore.DataSource = myObject; myStore.DataBind();
    ? Because in my situation, the first works, but the second doesn't.

    EDIT:
    After talking with a colleague, we decided to stop wasting your time with this until/unless I have a reproducible problem. :-) Please feel free to *CLOSE* this thread for now.

    Thanks!
    Last edited by ptrourke; Apr 22, 2014 at 5:25 PM.

Similar Threads

  1. Replies: 11
    Last Post: Jul 25, 2013, 9:34 PM
  2. Replies: 4
    Last Post: Apr 05, 2012, 2:38 PM
  3. How to use the DataBound event in Store?
    By ascsolutions in forum 1.x Help
    Replies: 1
    Last Post: Jan 11, 2012, 12:37 PM
  4. Replies: 7
    Last Post: Aug 12, 2011, 9:39 AM
  5. Event for Databound
    By lazycoder in forum 1.x Help
    Replies: 1
    Last Post: Aug 13, 2009, 9:31 AM

Posting Permissions