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
1935
Inserting rows and columns
posted

I haven't tried this yet, but just from reading the documentation, I'm not clear on how to insert new rows and columns.

I am not using a datasource helper.

Would you call gridView insertRowsAtPaths which would insert an empty row, followed by a call to gridView insertCellsAtPaths in order to populate the row?

Basically, I'm trying to add several rows of data to "Section Header One" when the user taps the magnifying glass on the section header.

The first column is field names, and the second column is field values.

Parents
No Data
Reply
  • 40030
    Verified Answer
    Offline posted

    Hi David, 

    Inserting Rows/Cells/Columns isn't really inserting data into your underlying data. It's just notifying the grid, that you already added a row to your backend data, and that you'd like for the grid to animate that row being inserted, instead of just adding the row/cell/column without animation. 

    So, if you wanted to add a row. 

    You'd update your backing data store, so if its an array, you'd insert your row. (Note, if you're implementing the datasource protocol, that means when the grid asks how many rows are in a section, it should include the added number of rows)

    Then you have 2 options. 

    1. call grid updateData . (this will insert tell the grid to refresh its data, but since you're not telling it why you're data is refreshed, there is no animation)

    2. call insertRowAtPath. (this tells the grid, that you've already updated your data, and that the new data is located at the specified path.) The grid will then animate that row to be inserted. (Note. If you call this method, DO NOT call updateData as this will terminate the animation)

    Insert Cells/Columns work the same way. Although you'd only use insertCells if you weren't using a row based grid, and were instead using a cell based grid. 

    Hope his helps. 

    -SteveZ

Children
No Data