Skip to content

Latest commit

 

History

History
75 lines (45 loc) · 3.28 KB

htmx.md

File metadata and controls

75 lines (45 loc) · 3.28 KB

htmx - Advanced reactive grids

Congratulations!

If you've made it this far you are now a py4web grid master. Our next step is to learn about how we can use htmx to bring our pages to life. Using py4web and htmx you can

  • Build editable forms with that work with no full page reloads
  • Build CRUD grids that work without full page reloads
  • Build complex auto-complete dropdown widgets for your forms

In this section we'll discuss

How did we get here

However, in today's world of full stack web development you need more than just back-end web frameworks. You need something that will give you live page interactions without page reloads. Around 2010 a new paradigm of web development was born in the form of javascript front-end frameworks like Node.js and AngularJS.

These tools allowed you to quickly build reliable page interactions with less javascript than was necessary before them. Soon a whole new breed of developers grew up utilizing React js and Vue.js to build entire applications and application front-ends in javascript. These javascript front-ends talked to back-ends through APIs that exchange JSON data.

Async back-ends began spouting up whose only purpose was to retrieve JSON payloads and send them back to javascript running in the browser.

As these new frameworks and tools grew, so did application complexity and boilerplate code.

Finally, some industry veterans thought it was time to stop the insanity. New javascript frameworks appeared that promised simpler live web pages using standard html techniques. A new set of tools were born.

  • htmx - high power tools for HTML
  • HOTWIRE - HTML over the web
  • I'm sure there are more, these are just the ones I'm familiar with

Using these tools you can now build live interactive (no full page reloads) web pages without all the complexity and verbosity of the previous javascript frameworks. Instead of requesting JSON data payloads (and then telling the javascript framework what to do with it), these frameworks request HTML from the server and will take the result and replace just a section of the current page. Visit the sites above for a more in-depth description.

back to top

py4web and htmx

The py4web grid comes with an implementation of htmx. However, building wrappers for other frameworks is trivial.

back to top

Exercise Overview

back to top

Solution Overview

back to top

Build the base grid

back to top

Add the Display Form

back to top

Add the Edit Form

back to top

Add the Child grid

back to top

Full Solution review

back to top

Back to Index