Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
250
Add/remove columns at runtime your
posted

hi all, I'm still very new to your API framework so please bear with me for what are likely stupid questions :-)

We will incorporate a grid into our mobile app, that is presenting data to the user via our backend server farm.

Let's say the dataset in question, returns 30 columns 

Wed like to allow the user to selectively add/remove columns to the grid at runtime. So for example, they may only want to see 3 of the columns now, but later in the day bring in all 30.

The data coming in from the backend server is dynamic (they may add or remove columns there) but we can monitor state in the mobile app, that's no prob  

It looks to me like this can be achieved with your Grid control, via instance methods such as deleteColumnsAtIndexes etc?

Parents
  • 40030
    Suggested Answer
    Offline posted

    Hi Angus, 

    Yes, you have full control at any given time what gets displayed. It's actually fully controlled by your DataSource implementation. You can use the DataSOurceHelpers, which implement a lot of logic for you already. 

    Basically the workflow goes like this. 

    Say you have 20 columns. 

    You want to remove the first 5. 

    1. Tell your DataSource that you're removing 5 columns. If you're using a DataSourceHelper, just delete the first 5 columns using the column definitions property. 

    2. Tell your DataSOurce to invalidate (call its invalidateData method)

    3. Call the grid's deleteColumnAtIndexes method with the first 5 indexes. 

    This will then animate the deletion of the columns. 

    If you don't care or want to animate. You can call updateData on the grid instead, and don't bother calling the deleteColumnAtIndexes method. 

    Hope this helps, 

    -SteveZ

Reply Children
No Data