0

I am building an cross platform mobile app using Icenium in a very short period of time and as such I am trying to learn HTML5 and CSS in a very short period of time. I am using the Kendo UI Mobile framework to build the app and I need to link a load a list of events from a remote database and have that database populate a listview in the app.

The database can be anything as I have open access to the server and can put what ever I want on it. I literally don't know where to begin though, any help would be very good. ATM I was looking at a mySQL database as it was the easiest and most secure to maintain.

Any ideas / experience in this matter?

4

2 回答 2

0

您可以考虑将 KendoUI MVVM 数据模型和模板与 AJAX 一起使用。

发布到您的服务器端点 - 它应该返回一个 JSON 响应:

function getRoutineDetailData(e) {
            //get data from server
            $.ajax({
                url: "http://dot.com/your_endpoint.php",
                dataType: "jsonp",
                type: "GET",
                data: { userID: userID},
                success: function(response) {
                    routineInfo = response.results;
                    routine_viewModel.set("info", routineInfo);

                }
            });
    }

现在绑定结果:

       //bind the results to the viewmodel            
        var routine_viewModel = kendo.observable({
            info: []
        });

视图还应该有一个模板:

        <script id="routineInfo-template" type="text/x-kendo-template">

        <div id="routineHeader" >
        <span id="RoutineText">${title} created on ${entry_stamp} by ${user_name}</span>
        </div>

    </script>

然后,您的视图应该调用该函数以使用 data-show 执行服务器发布,并使用数据模型让您访问数据,即。模板中使用的 ${title}:

<div data-role="view" id="view-routineDetail" data-show="getRoutineDetailData" data-model="routine_viewModel" data-title="routineDetail">
<div id="routineInfo" data-template="routineInfo-template" data-bind="source: info" ></div>
</div>

这是一个快速的解释,更多可以在http ://docs.kendoui.c​​om/getting-started/mobile/mvvm 找到

于 2013-05-16T16:58:19.060 回答
0

您选择的数据库与您的前端无关。您可以使用任何数据库,如 SQL Server、Oracle、MySQL(如果您有预算限制)等。您的 Kendo 前端不会直接与您的服务器数据库对话;为此,您需要使用 .NET/Java/或任何服务器端技术编写 HTTP 服务。现在该服务将与您的数据库对话并将数据(最好是 JSON 格式)返回到 Kendo UI。

Kendo UI <-> HTTP 服务 <-> 数据库[独立于 UI]

于 2013-03-25T14:49:10.947 回答