Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

SmartClient Server + Non-SmartClient Controls on the front end

$
0
0
I am using SmartClient on the front end only for datasource access and not including any of the controls. To get SC to work with no errors I have to include many dependencies that based on its names does not make sense to me (ISC_Grids.js for example).

The 5 files that are needed are about 3MB minified. I have added a sample test case below to show my setup.


Code:

<!DOCTYPE html>
<html>
        <head>
                <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                <title>Smart Client Test</title>
       

                <script type="text/javascript" >var isomorphicDir="isomorphic/";</script>
                <script type="text/javascript" charset="UTF-8" src="isomorphic/system/modules/ISC_Core.js"></script>
                <script type="text/javascript" charset="UTF-8" src="isomorphic/system/modules/ISC_Foundation.js"></script>
                <script type="text/javascript" charset="UTF-8" src="isomorphic/system/modules/ISC_Containers.js"></script>
                        <script type="text/javascript" charset="UTF-8" src="isomorphic/system/modules/ISC_Grids.js"></script>
                <script type="text/javascript" charset="UTF-8" src="isomorphic/system/modules/ISC_DataBinding.js"></script>
                <script type="text/javascript" charset="UTF-8" src="isomorphic/skins/Mobile/load_skin.js"></script>
       
       
        </head>
        <body>
                <br><br><br>

                <button onclick="fetchData()">Fetch data from different server</button>
                <br><br>
                <div id="fetchedData"></div>

                <script>
       
                //Data source that will call cross origin server
                isc.DataSource.create({
                    ID:"webCategoryDataSource",
                    dataURL: "http://qa.juxappose.com/isomorphic/IDACall",
                    fields:[
                        {
                            title:"Category ID",
                            primaryKey:true,
                            name:"categoryId",
                            type:"text",
                            required:true
                        },
                        {
                            title:"Name",
                            name:"name",
                            type:"text",
                            required:true
                        },
                        ]
                });
               
                        //function that is used to fetch the data
                        fetchData = function(){
                               
                       
                                webCategoryDataSource.fetchData(null, function(dsResponse, data, dsRequest){
                       
                                        var list = "<ul>";
                                        for(var i = 0; i < data.length; i++)
                                                list += "<li>" + data[i].name + "</li>";
                                               
                                        list += "</ul>"
                                document.getElementById("fetchedData").innerHTML = list;
                        });
                       
                        }
        </script>
       
       
        </body>
</html>

Is there a way to reduce the number of files needed on the client side that only requires SC Datasources? Is there a better way to tap into a SC backend Datasources?

Viewing all articles
Browse latest Browse all 4756

Trending Articles