In render(), we will simply replace the contents of the cell DOM element with the badge HTML code snippet provided by the Bootstrap docs that we just saw. It must return a String containing a JavaScript class that extends XojoWeb.ListboxCellRenderer, containing a render() method inside (remember that JavaScript is case-sensitive). JavascriptClassCode event will be executed only once, no matter the amount of instances of our renderers we have. Let’s add this code to the Serialize event, we will come back to this event later: Return New JSONItem ![]() But it is important to know that Serialize must return an instance of a JSONItem class, or you will get a NilObjectException, as soon as you add a new row using this renderer. We will ignore all of them for the moment, except JavascriptClassCode. There are three: Deserialize, JavascriptClassCode and Serialize. It will be a child of WebListboxCellRenderer Superclass.Įxtending WebListBoxCellRenderer will allow our class to listen to some events that Xojo will emit, used to render our badges inside the table. The first step is to create a new class in our Xojo project. If we think about it, in a nutshell, what we want to achieve is to inject this HTML (coming directly from Bootstrap’s docs) into our cells: Primary Today we will create a very basic example, a Custom Cell Renderer capable of showing Bootstrap Badges. In order to do so, be prepared to write some JavaScript code. Anything you can imagine can be done inside your WebListView control cells. ![]() ![]() In case you missed it, the previous article explains in detail what Cell Renderers are and how to use them. In this second part, you will learn how to create your very own controls using Xojo’s WebSDK. There is something that is even better than using Cell Renderers from third parties- building them yourself.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |