creating a table in ionic

后端 未结 9 1586
一向
一向 2021-01-31 03:27

I am in need of creating a table in Ionic. I thought of using Ionic grid but could not achieve what I wanted. How can I do this? Here is an image of something similar to what i

9条回答
  •  感动是毒
    2021-01-31 04:03

    You should consider using an angular plug-in to handle the heavy lifting for you, unless you particularly enjoy typing hundreds of lines of knarly error prone ion-grid code. Simon Grimm has a cracking step by step tutorial that anyone can follow: https://devdactic.com/ionic-datatable-ngx-datatable/. This shows how to use ngx-datatable. But there are many other options (ng2-table is good).

    The dead simple example goes like this:

    
      
        
        
        
      
    
    

    And the ts:

    rows = [
        {
          "name": "Ethel Price",
          "gender": "female",
          "age": 22
        },
        {
          "name": "Claudine Neal",
          "gender": "female",
          "age": 55
        },
        {
          "name": "Beryl Rice",
          "gender": "female",
          "age": 67
        },
        {
          "name": "Simon Grimm",
          "gender": "male",
          "age": 28
        }
      ];
    

    Since the original poster expressed their frustration of how difficult it is to achieve this with ion-grid, I think the correct answer should not be constrained by this as a prerequisite. You would be nuts to roll your own, given how good this is!

提交回复
热议问题