来自Google电子表格的下拉列表

时间:2013-06-18 06:10:14

标签: json drop-down-menu google-sheets

This fiidle有一个示例下拉列表,其中的数据来自硬编码的json格式,如下所示。

   var data = [
        {
        "department": "IT",
        "subject": [
            {
            "title": "Programmer",
            "services": [
                {
                "name": "example1"},
            {
                "name": "example2"}
                          ]

            },
        {
            "title": "Solutions Architect",
         "services": [
                {
                "name": "example3"},
            {
                "name": "example4"}
                          ]
},
        {
            "title": "Database Developer"}
        ]},
    {
        "department": "Accounting",
        "subject": [
            {
            "title": "Accountant"},
        {
            "title": "Payroll Officer"},
        {
            "title": "Accounts Clerk"},
        {
            "title": "Analyst"},
        {
            "title": "Financial Controller"}
        ]},
    {
        "department": "HR",
        "subject": [
            {
            "title": "Recruitment Consultant"},
        {
            "title": "Change Management"},
        {
            "title": "Industrial Relations"}
        ]},
    {
        "department": "Marketing",
        "subject": [
            {
            "title": "Market Researcher"},
        {
            "title": "Marketing Manager"},
        {
            "title": "Marketing Co-ordinator"}
        ]}
    ]

是否可以使用Google电子表格中的数据创建相同类型的下拉列表?如果是这样,电子表格中需要什么数据格式?

编辑:是否可以使用数据源创建相同的下拉菜单

var query = new google.visualization.Query("http://spreadsheets.google.com/tq?key=0AozvCNI02VmpdDBKYUhRdVVhb2xGel91c2FkV1daYkE&single=true&gid=0&pub=1");
       query.send(handleQueryResponse);
       }
       function handleQueryResponse(response) {
          var data = response.getDataTable();

来自this spreadsheet

0 个答案:

没有答案