0

我从我的 mysql 数据库中接收客户数据。我想在分段表视图中显示所有客户。每个部分的标题是客户姓名的第一个字母,每个部分中的 numberOfrows 是以相同字母开头的客户数。基本上它应该看起来像我 iPhone 上的联系人应用程序。

这是我的数据http://mobile.beger.org/getdata.php53?object=customer&mode=all

现在我可以在我的 tableView 中显示所有客户。我怎样才能把客户分成几个部分?我必须编辑我的mysql选择吗?或者我应该有两个 json 字符串。一个是每封信和以这封信开头的客户数量,另一个是客户详细信息?

谢谢你的帮助!

4

1 回答 1

0

您正在使用这种块来获得简单且便宜的解决方案。我已编辑您的网络服务响应。请看一下。

{
  "customer": [
    { "A": [
      {
        "i_customer_m": "22",
        "s_name1": "Amann Solutions AG",
        "s_town": "Herisau"
      },
      {
        "i_customer_m": "5",
        "s_name1": "Architekturhaus Leibold GmbH",
        "s_town": "D\u00fcnkelsried"
      },
      {
        "i_customer_m": "68",
        "s_name1": "ATEcare Service GmbH & Co.KG",
        "s_town": "Aichach"
      },
      {
        "i_customer_m": "83",
        "s_name1": "Autohandel Polska GmbH",
        "s_town": "Prag"
      },
      {
        "i_customer_m": "65",
        "s_name1": "Autohandel Polska GmbH",
        "s_town": "Prag"
      }
    ]},
    {"B": [
      {
        "i_customer_m": "45",
        "s_name1": "Baugenossenschaft Strassbourgh",
        "s_town": "Strassbourgh"
      },
      {
        "i_customer_m": "11",
        "s_name1": "Baugenossenschaft Wien",
        "s_town": "Wien"
      },
      {
        "i_customer_m": "1",
        "s_name1": "Betzy AG",
        "s_town": "Germering, Oberbayern"
      },
      {
        "i_customer_m": "46",
        "s_name1": "BSG",
        "s_town": "Herrsching am Ammersee"
      },
      {
        "FirstLetter": "B",
        "i_customer_m": "67",
        "s_name1": "BVVS Systemhaus GmbH",
        "s_town": "M\u00fcnchen"
      }
    ]}
  ]
}

谢谢,

于 2012-04-12T13:27:59.200 回答