Telerik - extract posts from Wordpress site

2 posts, 0 answers
  1. Stephane
    Stephane avatar
    2 posts
    Member since:
    Dec 2015

    Posted 20 Dec 2015 Link to this post

    Hi!

    I am new to Telerik, and would like to test it out if it would help me with the projects I am doing. One important feature that I am testing is if I can connect the Telerik mobile app to a wordpress website. I found a tutorial from Telerik explaining just that over here.

    However, when I test out the application that the writer post on Github, I just get a blank (white) screen.

    The app uses the following in index.html:

    <div id="tabstrip-posts"
            data-role="view"
            data-title="WP Posts"
            data-model="app.postsService.viewModel">
     
            <ul data-role="listview"
                data-style="inset"
                data-bind="source: postsDataSource"
                data-template="posts-template">
            </ul>
        </div>
     
        <!--Users template-->
        <script type="text/x-kendo-tmpl" id="posts-template">
            <a>
                <div>
                    <div>
                        <span>${title}</span>
                    </div>
                    <div>
                        <span>${author.name}</span>
                    </div>
                </div>
            </a>
        </script>

    I also uses a posts.js, which includes:

    (function (global) {
        var app = global.app = global.app || {};
     
        PostsViewModel = kendo.data.ObservableObject.extend({
            postsDataSource: null,
     
            init: function () {
                var that = this,
                    dataSource;
                kendo.data.ObservableObject.fn.init.apply(that, []);
     
                dataSource = new kendo.data.DataSource({
                    schema : {
                        model:
                        {
                            id: "id",
                            nicename: "nicename"
                        }
                    },
                    transport: {
                        read: function (options) {
                        $.ajax({
                            type: "GET",
                            url: "http://european-aluminium.onebonsai.com/api/get_recent_posts/",
                            dataType: "json",
                            success: function (result) {
                                options.success(result.posts);
                                console.log("read success");
                            },
                            error: function (result) {
                                console.log("read error: " + result);
                            }
                        });
                    }
                    }
                });
     
                that.postsDataSource = dataSource;
            }
        });
     
        app.postsService = {
            viewModel: new PostsViewModel()
        };
    })(window);

    Can it be that the new Telerik does not support such AJAX calls anymore? I do not even get a console error in this example...

    Thanks!

  2. Tsvetina
    Admin
    Tsvetina avatar
    1873 posts

    Posted 23 Dec 2015 Link to this post

    Hello Stephane,

    The project from the sample is an old one and that is probably why you had problems running it. I copied the source files into a blank AppBuilder app and it works for me. I am attaching the app to this message for your reference.

    Regards,
    Tsvetina
    Telerik
     

    Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

     
Back to Top