HTML5

JavaScript Client Framework Has A Powerful Data Platform Model

Data and how you handle it is the heart of every application you create, whether it is simple or complex. How you handle your data drives your applications and determines your credibility and success as a business application developer. With such high stakes involved, it is important to recognize data as one of your most valuable development resources and, as such, to handle it with due care and attention inside your applications. Sencha ExtJS is aware of the importance of handling data correctly and has implemented many features to streamline your development and data handling processes. In Sencha ExtJS, the data package loads and saves all of the data in your application. It consists of a multitude of classes that contribute to the way you handle data. In this article, we’ll take a brief tour of ExtJS’s data package and help you better understand its core concepts. What is a model in the data package of a Sencha application? A model is the most important part of a data package. Everything else in your application is connected to and revolves around the model. This makes it the heart of the entire data package. Some of the principal parts of Ext.data.Model include fields, proxies, validations, and associations. A sample ExtJS model is defined in the code snippet below. Ext.define(‘MyApp.model.Base’, { extend: ‘Ext.data.Model’, fields: [{ name: ‘id’, type: ‘int’ }], schema: { namespace: ‘MyApp.model’, // generate auto entityName proxy: { // Ext.util.ObjectTemplate type: ‘ajax’, url: ‘{entityName}.json’, reader: { type: ‘json’, rootProperty: ‘{entityName:lowercase}’ } } } }); How are proxies used in an end-to-end client-server cycle? There are two types of proxies in ExtJS — client and server. The client proxy may include memory and local storage to store the data on the client-side, whereas, the server proxy handles the marshaling of data to a remote server, for instance, Ajax, JSONP, and REST. Generally, these proxies are used by ExtJS models and stores to handle the loading and saving of model data. How can I create a store in ExtJS? A store, in ExtJS, is a collection of records of model instances. When defining a store, you need to define its linked model as well. Following is a simple code that allows you to create a store for User model and load its data using the load() function on Store object. var store = new Ext.data.Store ({ model: ‘MyApp.model.User’ }); store.load({ callback:function(){ var first_name = this.first().get(‘name’); console.log(first_name); } }); One of the fascinating things about a store is that it allows you to define sorting parameters. Based on the sorting and grouping preferences, the store filters and then returns the data. How can I establish associations between models? Models can be linked with each other using associations. In any real-world application, your entities are always linked together. This should be reflected in your model-level structure as well. For instance, your social media application contains a User and Post model. The Post model and its instances have no standalone semantic value. However, if it associates with a User model then it makes real sense. In ExtJS, model associations for this social media example can be defined as follows: Ext.define(‘MyApp.model.User’, { extend: ‘MyApp.model.Base’, fields: [{ name: ‘name’, type: ‘string’ }] }); Ext.define(‘MyApp.model.Post’, { extend: ‘MyApp.model.Base’, fields: [{ name: ‘userId’, reference: ‘User’, // the entityName for MyApp.model.User type: […]

Read More

Rapidly Deploy Visually Stunning Themes For Your Javascript Apps

Give some style for your application is crucial to give life to your products and attract the end-user. But sometimes has a high cost to implements it using CSS. Sencha has a solution which helps solve this problem through a smart theming solution. Sencha Themer empowers you to style Ext JS, ExtAngular and ExtReact apps and make them look great. You can create custom themes using graphical tools – without writing code. Themer gives you access to components and inspection tools to set fine-grained styles and generate theme packages with dynamic stylesheets. With the innovative color palette in Themer, it’s easy to apply different color combinations to different component states. The color palette shows base, body background, and font color with progressively lighter and darker colors. There is also a palette that helps you select colors from Material Design. The Themer font management option allows you to quickly add web fonts from Google fonts. This tool allows you to transform your desktop, tablet, and phone application into a beautiful and modern application creating your own theme without any line of code! What is Sencha Themer? Sencha Themer is a tool to create new themes for your application based on pre-defined themes in a very fast and productive way. The theme created can be exported and shared to reuse again and again. You have the color palette to choose the best base colors, select body background, and font color with progressively lighter and darker colors. There is also a palette that helps you select colors from Material Design. The Themer font management option allows you to quickly add web fonts from Google fonts. There is also access to components and inspection tools to set fine-grained styles and generate theme packages with dynamic stylesheets. Getting Started First, download here and install Sencha Themer on your machine. Second, you will create your new Ext JS, ExtReact, or ExtAngular application to apply the new theme and see updates applying live. Creating the Application You can create a new application by running the commands below: sencha -sd /Users/fabio/sencha-sdks/ext-7.4.0/ generate app AppNewTheme ./app-new-theme-extjs And start your application: cd app-new-theme-extjs/ && sencha app watch Now open your application with fashion option enabled, with this URL: http://localhost:1841/?platformTags=fashion:true How can I change my theme using Sencha Themer? Now that your application is ready and running, let’s open our application on Sencha Themer to change it with whatever you want to give your personality to your application. Follow the steps below to create your own theme. After opening it, click on Create Theme button: Fill the informations about the new theme, giving a name, select your application path on App field, the toolkit of the application you would like to apply the new theme, and finally the base theme you will be based on to create your new theme, then click on Create Theme: After open the theme, select a color on base color field to see it in action: Then when you open your application, you can see that changes were applied automatically: How do I change styles for Specific Components? You can also personalize specific components like buttons, toolbars, grids, forms, and many other components on your application. For our app, let’s change our grid a little bit. From the left side, select the grid component, and then […]

Read More

Rapidly Build Testing Automation To Supercharge Javascript App Quality

The need to find and fix quality issues early in the development cycle has always been baked into the core philosophy of every serious development team, even in the face of intense delivery pressure. The evolution of web technology introduced a new urgency for software quality. Sencha Test is the most comprehensive unit and end-to-end testing solution for Ext JS, including support for end-to-end testing of ExtAngular, Angular, ExtReact and React apps. Deliver higher quality apps and reduce testing time & cost with powerful automation through Sencha Test. What are the benefits of a testing framework? Reduces barriers to testing by providing a professionally designed, documented and supported testing framework for Ext JS and ExtReact apps Shortens testing startup time by delivering pre-authored tests for complex Ext JS and ExtReact example apps Automates testing by allowing scheduled, unattended test runs that leverage CI Empowers users to develop a large number of tests with an easy-to-use JavaScript built-in editor Improves code quality, accelerates time to market, and ensures a consistent end-user experience In this article we will learn more about Sencha Test and how you can use it to increase the quality if your software output. With Sencha Test, you can create end-to-end tests quickly, and execute them on multiple browsers simultaneously. Cross-browser testing is critical to ensuring quality for organizations, and test automation is a requirement to meet delivery timelines. Sencha Test helps you build an end-to-end testing plan without having to cobble together testing tools. Is there an IDE I can use to write Javascript tests? Sencha Test Studio is the graphical user interface that allows you to write Jasmine tests in a built-in Sencha Test editor. You can write tests using JavaScript and store them in your team’s preferred source control system. Test Studio allows you to create tests directly in Sencha Test, or code in a separate IDE, and execute the test immediately. The iterative unit testing process helps you create more robust code by constantly testing it along the way. What tools can I use to automate Javascript tests? Using Test Runner, you can run selected unit and functional tests on any or all of the browsers on a local machine, a connected mobile device, or on a browser farm. The local Test Runner can be used for test creation and debugging. An external browser farm or a Selenium grid is used by the Sencha Test Command Line Interface (CLI) to run the same tests on a Continuous Integration (CI) system – allowing you to schedule automated test runs nightly or at a convenient time, with minimal configuration. Sencha Test Command Line Interface (CLI) helps you achieve the full power of automated test runs. Once tests are authored and checked into the source control repository, you can launch them from your Continuous Integration (CI) system. The CI system can invoke the CLI automatically, once it senses a change to the application code or the test files in the source control repository. How can I access historical Javascript test results easily? The Test Archiver enables you to track historical testing trends in your projects as well as compare results between runs. Automated visual analysis allows you to identify runs where screens do not render correctly or visual glitches are present. The archiver leverages the full power of […]

Read More

Quickly Build And Test Javascript Apps In The Browser With This IDE

Web-based IDEs reside entirely on a remote server and are accessible through the browsers. Unlike the typical IDEs on your PC, you don’t have to go through any installation process. Also, they enable you to collaborate with other developers conveniently. You can share code examples with your colleagues easily. They can play with your code and make necessary adjustments. You can enjoy all of these benefits using Sencha Fiddle. It is a web-based IDE for running and sharing your Ext JS code examples. In this post, you will find a step-by-step guide for using the editor. What is Sencha Fiddle? Sencha Fiddle is an online IDE for creating, running, and sharing code examples using the Ext JS framework easily. It mimics the local development environment in the cloud. You can use it to test and prototype applications conveniently. Why should you use Sencha Fiddle? Easy to use Run, edit and share Ext JS codes online Super-fast performance What can you do with the Sencha Fiddle? Fork and Share Fiddles Sencha Fiddle enables you to change all the aspects of the fiddle, including the code and folder structure. It gives you flexibility. You can save your code to the Fiddle Server and share your work with your colleagues and community. The process of sharing the fiddle is very simple. Simply click on the share button. A new window will open up. It will contain a few lines of code, which you can use to display your work through an IFrame. Protect Fiddles with Passwords You can protect the fiddle with a password to prevent unauthorized access. No one can play with your codes without your permission. The process of securing the fiddle with a password is very simple. Here are the steps: Hit the Admin button. Then Details. A new window will open up. Scroll down to find and expand Advanced Options. Insert your preferred password. Finally, hit the Set button. That’s it! Now, no one can edit your fiddle without entering the specified password. Lock Fiddles for Confirmation Prompt Another thing you can do is locking fiddles to prevent others from editing them unless a confirmation prompt is acknowledged. It is a great way to control access to your codes effectively. To lock the fiddle, simply check the box of the Locked field. Assign Fiddles to Team You can assign the fiddles to different teams. Each of the users will have custom-defined edit privileges. So, you can enjoy granular control over the fiddles and the persons who are interacting with them. To assign a fiddle to a team, simply follow these steps: Navigate to Admin > Teams. A new window will open up. Click Add To Team button. Select the team from the dropdown. Then hit Choose Team button. That’s how you assign a fiddle to a specific team. Add Fiddles to Groups In Sencha Fiddle, Groups are “albums” of fiddles. They provide additional user-defined organization for your fiddles. Besides, Sencha Fiddle offers support for Dynamic groups. They automatically curate the fiddles based on pre-defined search criteria. To add a fiddle to a group, simply follow these steps: Head to Admin > Groups. A new window will appear. Click Add To Group button. Choose your preferred group from the dropdown. Then click the Choose Group button. That’s it! Now, you […]

Read More

Easily Debug Javascript Ext JS Apps With This Powerful Tool

Developing an application is not easy, mainly talking about a web application, where you can expect any kind of problems depending on user environment, the internet speed, machine performance limitation, remote server availability, different browsers with different behavior and many other unexpected situations where the developer will have to fix the problem. But sometimes is very hard to identify a UI problem even using browser tools. To help with that we have a powerful product: The Sencha Inspector! What is Sencha Inspector? This is a complete tool that helps developers to debug Ext JS applications giving options to inspect anything about an Ext JS application and its ecosystem. It will help you keep the best performance and quality to your application! What are the most interesting Sencha Inspector features? This tool was designed specifically to inspect Ext JS application with many options to monitor and inspect, like: Components: identifying its id, xtype, layout, and other dynamic details, including properties, methods, layout, and the MVVM structure. Stores: checking what model was applied to id, proxy, and properties like URL, parameters and also monitor all records present in the store to easily debug the application behavior. Layout: verify what and how many times each layout is running for each component to see the performance or layout loopings are happening. Events: monitor any kind of events running and their parameters to understand who is calling if is there any unnecessary events executing that will affect the application performance. Architecture: you can see the whole project architecture in a single place (including the Ext JS framework structure). Theme: where you can change styles on the SASS variables that will apply dynamically to your app in real-time. After that, you can just copy your changes and apply them to your application! App Details: show all versions of sencha products used and their license, so here you can monitor if you are using a compatible version of Ext JS with Sencha CMD for example, and also understand the theme hierarchy applied on your application. These and many other options and all on the fly! You can see all details while your app is running and sometimes also change, like on the Theme option. On Sencha Inspector documentation has a complete guide with all steps to understand how to install and use it in detail. Check it here. How to debug and Ext JS Application with Sencha Inspector? Let’s see Sencha Inspector in action! Creating the Application You can create a new application running the commands below. To see more details on how to create an application using templates, check this previous post for more details. sencha -sd /Users/fabio/sencha-sdks/ext-7.4.0/ generate app -s /Users/fabio/sencha-sdks/ext-7.4.0/templates/admin-dashboard AdminDashboard ./admin-dashboard-extjs Now, to have the theme option enabled and working on the fly, we need to enable the fashion option on our app.json file. On the sass section, add the save property: { … “sass”: { “save”: “sass/save.scss”, //accepts .scss or .json file types … } } After that, open the Sencha Inspector, and on terminal navigate to your application folder, and then run the watch command with the inspector option enabled: sencha app watch –inspect Now open your application with this URL: http://localhost:1841/?platformTags=fashion:true After that, you will see your application ready to inspect on your SenchaInspector: Double click on it to see […]

Read More

Turbocharge You Modern Web Apps With Pre-Built UI WebComponents

There are many popular JavaScript frameworks that offer a component-based approach to building web apps. However, most of these do not include any pre-built components. JavaScript developers are faced with the choice of either building these components from scratch or getting them from the community. You can develop web applications faster by using ExtWebComponents. ExtWebComponents includes 140+ pre-built and pre-tested UI components. ExtWebComponents provides all the components a developer needs to build data-intensive web apps. You get components that interact seamlessly, and are professionally built, tested and maintained. How can I build responsive designs with WebComponents? Developers can use the built-in Material design inspired theme, eliminating the need to construct custom styles and making it easy to create a fresh, modern user experience with minimal effort. Themes can also be easily modified or extended within Sencha Themer, enabling both developers and designers to create compelling themes without writing a single line of code. Fonts, colors, and padding can all be modified with ease to make components fit the motif of the application. Adaptive and responsive design enables teams to build immersive user engagement by using layouts and adaptive design features. A flexible layout manager helps to organize the display of data and content across multiple browsers, devices, and screen sizes. It helps developers to control the display of components, even for the most complex user interfaces. What are some of the features available in ExtWebComponents? Grid — Handle millions of records and provides built-in functionality such as sorting and grouping. Pivot Grid — Add powerful analytics functionality to React applications. Exporter — Export data from the standard grid or Pivot Grid to a wide variety of common formats. Layouts — Ensures the proper sizing and positioning of all components with the powerful and flexible layout system. Charts — Visually represent data with a broad range of dynamic and static charts including line, bar, and pie charts. D3 Adapter — Add sophisticated Data-Driven Documents package (D3) visualizations such as heatmaps, treemaps, sunbursts and more to your web applications. How can I integrate WebComponents with data? The robust data package included in ExtWebComponents decouples the UI components from the data layer. The data package: Allows client-side collections of data using highly functional models that offer features such as sorting and filtering. Is protocol agnostic, and can consume data from any back-end source. Comes with session management capabilities that allow several client-side operations, minimizing round-trips to the server. How can I see ExtWebComponents and GXT in Action? The following video covers using ExtWebComponents in GXT templates. It will start by showing how to quickly import ExtWebComponents into your project. Then show you how to construct a web component with an Ext JS web component. Then show you how to import your custom element into your GXT application. How can I build my own WebComponents? A web component can be considered a custom html element, like  which is constructed below. Create a custom component with 3 easy steps. Start by declaring the reusable class element with the web component construction. Then register the class for which will be used for the components construction. Once you’ve constructed and registered the component you can declare it anywhere with // 1. Define the reusable component class MyViewElement extends HTMLElement { constructor() { super(); // The components html template […]

Read More

Easily Access GraphQL Resultsets In Your Javascript Apps

If you’re an online service or a product, knowledge about your user base is one of the first and most important mechanisms to maintain customer retention by designing modules in accordance with customer preferences. Essentially, it will help your service generate hits and eventually boost the market value of your product or service. GraphQL is an open-source data query and manipulation language for APIs, and a runtime for fulfilling queries with existing data. It provides a complete and understandable description of the data in your API and gives clients the power to ask for exactly what they need and nothing more. GraphQL makes it easier to evolve APIs over time and enables powerful developer tools. In this blog post, we’ll look at how we can use the power of GraphQL to seamlessly create an end-to-end user information base with Sencha Ext JS. How can I quickly set up a GraphQL HTTP server? If you do not currently have an Apollo Server for GraphQL running on NodeJS you can follow this tutorial to set one up. It mainly involves installing the dependencies like this: npm install apollo-server graphql To set up the server-side responders for your GraphQL interface, you just need to define the schema that interacts with the endpoint logic. You can design the User schema as follows. const { ApolloServer, gql } = require(‘apollo-server’); const typeDefs = gql` type User { firstName: String lastName: String username: String email: String } type Query { users: [User] } `; Once you have defined the user schema, you now need to configure the relevant resolvers; user resolver in our case. Resolvers are used to define the technique for fetching the types defined in the schema. const resolvers = { Query: { users: () => users, }, }; Now, we need to start the server so that it can be used by our Sencha Ext JS client (that we will create in the next section). const server = new ApolloServer({ typeDefs, resolvers }); server.listen().then(({ url }) => { console.log(`Server ready at ${url}`); }); How can I create a GraphQL schema in Ext JS for the user information base? We now have our server up and running. Next up is the GraphQL schema definition in Sencha Ext JS. Define your schema and query as follows. type Query { getUsers( limit: Int offset: Int orderBy: String filter: String ): Users user(id: Int!): User } type User { username: String firstName: String lastName: String email: String } type Users { count: Int users: [User]! } What is an easy way to integrate GraphQL HTTP server with Sencha Ext JS client? Before initializing the Sencha application and writing a script to interact with the server using GraphQL patterns, the following dependencies must be installed. npm install –save @apollo/client npm install –save graphql Once you have installed the required dependencies, import them into the application to use them as follows. require(‘graphql’); GraphQLApp.xApolloClient = require(‘@apollo/client/core’); While launching the Sencha application, you need to create a singleton instance of Apollo Client to manage API calls and requests to the server using GraphQL patterns. Ext.define(‘GraphQLApp.GraphQL’, { alternateClassName: [‘GraphQL’], singleton: true, client: null, initClient(baseUrl) { this.client = new GraphQLApp.xApolloClient.ApolloClient({ cache: new GraphQLApp.xApolloClient.InMemoryCache({}), uri: baseUrl, defaultOptions: { query: { fetchPolicy: ‘network-only’, errorPolicy: ‘all’, }, mutate: { errorPolicy: ‘all’, }, }, }); }, }); Finally, send […]

Read More

20 Powerful APIs That Will Supercharge Your Javascript Apps

Due to JavaScript’s low barrier of entry, it is the most popular programming language for building web applications. On that note, there are many remarkable JavaScript frameworks built to make your app development process easier. The Sencha Ext JS JavaScript framework is one of the most powerful and can turbocharge your development.  Sencha Ext JS is also the most comprehensive JavaScript framework for building data-intensive, cross-platform web and mobile applications for any modern device. It includes 140+ pre-integrated and tested high-performance UI components.  That said, considering the numerous Javascript use cases, it is generally an interpreted language. And, in today’s world, where time is of the essence, you cannot overstate the need for seamless and fast applications. To this end, Sencha Ext JS supports Rest APIs. With this framework, you can easily access APIs to turbocharge your web apps. Head over and check out the Sencha Ext JS documentation for making a REST API call. Let’s look at 20 powerful APIs that can boost your Javascript apps.  Ipstack The ipstack API is a powerful, real-time IP to geolocation API capable of looking up accurate location data and assessing security threats originating from risky IP addresses. It delivers results within milliseconds in JSON or XML format. With this API, you can locate website visitors at first glance and adjust your user experience and application accordingly. Userstack Userstack offers a real-time, easy-to-use REST API interface capable of parsing User-Agent strings to accurately detect device, browser and operating system information. Implementing the JSON/XML API in your frontend or backend system will give you all the tools you need to take control of your website’s or application’s user experience and the customer journey that goes with it. https://userstack.com/ Positionstack The positionstack API was built to offer a straightforward and reliable solution for forward and reverse geocoding, covering more than 2 billion places and addresses worldwide. Its results can be delivered in JSON, XML or geocode-specific GeoJSON. Also, Average API response times range between 10ms and 100ms depending on the size of your request. https://positionstack.com/ Languagelayer Languagelayer is a simple and powerful REST API built to efficiently match text of any length to its corresponding language, cross-referencing single words, expressions and grammatical constructions, as well as taking into account any existing accents, dialects and other linguistic deviations. https://languagelayer.com/ ipapi  ipapi provides an easy-to-use API interface allowing customers to look up various pieces of information IPv4 and IPv6 addresses are associated with. For each IP address processed, the API returns more than 45 unique data points, such as location data, connection data, ISP information, time zone, currency and security assessment data. This API is REST-based, lookup requests are made using straightforward HTTP GET URLs and results are returned in lightweight JSON or XML format within a matter of a few milliseconds. https://ipapi.com/ Mailboxlayer  Mailboxlayer offers a simple REST-based JSON API enabling you to thoroughly check and verify email addresses right at the point of entry into your system. In addition to checking the syntax, the actual existence of an email address using MX-Records and the Simple Mail Transfer Protocol (SMTP), and detecting whether or not the requested mailbox is configured to catch all incoming mail traffic, the mailboxlayer API is linked to a number of regularly updated databases containing all available email providers, which simplifies the […]

Read More

Tutorial: Rapidly Build Powerful Custom Calendars In Javascript

Whether you are an individual or a business, organizing your personal or professional time with effective scheduling is an important part of being efficient. Most people organize their days using a calendar of some sort. If you are keeping track of your next Zoom meeting, tracking your deadlines, or trying to remember a co-worker’s birthday, calendars keep you on track. They help you avoid the unpleasant surprise and embarrassment of missed appointments. However, to be truly useful, a calendar also has to be available. That means having access to your scheduling information or personal calendar on all of your devices, not just your laptop or company desktop. This demand for always-there calendar information has spurred the development of a number of complex web calendar components. While it may be difficult to choose and implement the one that is right for you there is an easy solution — the Ext JS calendar component. The Ext JS calendar has all the high-end scheduling features you will ever need. These include creating or moving events with drag and drop, easy Google Calendar account connection, and much more!  With Ext JS, you can easily build and drop the calendar perfect for you straight to your app. Today we are going to implement a powerful calendar in a few steps that cover all the important details and use best practices. How can I get Getting Started with Sencha CMD? The first step, as always begins, in Sencha CMD. If you still don’t have Sencha CMD, you can download it for free here. Once you have it installed you can make sure you have it properly installed and configured by running this command on terminal/shell: If it returns the sencha cmd version, you are good to go. Here are more details on how to install, configure and use Sencha CMD, but this article will show all the important details. How can I create the Sencha application? The first thing you want to do is create your project structure. Sencha CMD can do this for you easily–all you need to do is run this command. If you have any questions, take a look at the bullet points below. They explain what everything in the command does and what you will need to change to personalize your application. sencha -sdk /Users/fabio/sencha-sdks/ext-7.4.0/ generate app modern Calendar ./calendar-extjs /Users/fabio/sencha-sdks/ext-7.4.0/ is where your Ext JS folder is. Calendar is the name of our application and the namespace for our classes. ./calendar-extjs is the path for our project structure and the necessary files. modern is the toolkit for our application. Make sure when you run this command that there is no error on the output. If there is no error, and everything runs correctly, you have successfully created your project structure. To be sure, however, let’s run our application with the initial structure. To do this, first navigate to your project folder: Then, run the command to open the server on a specific port: The output of this command will return the URL where your app is available. In this case, it is running on  http://localhost:1841/. When you open it on your browser you will see a screen like this: How can I clean up the Sencha project? Once you have your basic project running, you can clean it up by removing the files and […]

Read More