[Lift] Re: Guidance on using ExtJS with Lift for CRUD?
Hi -
Sorry for these newbie questions - I'm still getting started with web
apps and Lift.
The questions below could probably be answered all at once if somebody
could post a prototype Lift project which uses an ACID relational
database (eg, Postgresql) and an ExtJS GridPanel.
Say I have the following:
- sbt installed
- a prototype Lift 2.1 project 'proj001' in c:\www\lift\proj001,
- a Postgresql server running on port 5432,
- ExtJS in directory c:\www\extjs-3.3.0
If I cd to c:\www\lift\proj001 and do:
sbt update ~jetty-run
then pointing the browser to http://localhost:8080 shows the prototype
Lift 2.1 app.
Now I would like to modify this prototype Lift app in order to use an
ExtJS GridPanel and Postgresql (to display, say, the User table) -
similar to the example here:
http://dev.sencha.com/deploy/dev/examples/restful/restful.html
I'm guessing that it would be sufficient to:
- modify the following two *.html files:
(1) C:\www\lift\proj001\src\main\webapp\templates-hidden\default.html
(2) C:\www\lift\proj001\src\main\webapp\index.html
- modify the following two *.scala files:
(3) C:\www\lift\proj001\src\main\scala\code\model\User.scala
(4) C:\www\lift\proj001\src\main\scala\bootstrap\liftweb\Boot.scala
- and add a *.js file:
(5) C:\www\lift\proj001\src\main\webapp\restful.js
(based on http://dev.sencha.com/deploy/dev/examples/restful/restful.js)
In more detail...
(1) Looking at the source of:
http://dev.sencha.com/deploy/dev/examples/restful/restful.html
I assume I should add the following lines (adjusting the directory
paths as appropriate to link to the ExtJS libraries):
<script type="text/javascript" src="../../ext-all.js"></script>
<script type="text/javascript" src="../shared/extjs/App.js"></
script>
<script type="text/javascript" src="restful.js"></script>
<script type="text/javascript" src="../ux/RowEditor.js"></script>
<link rel="stylesheet" type="text/css" href="restful.css" />
<link rel="stylesheet" href="../ux/css/RowEditor.css" />
to file:
C:\www\lift\proj001\src\main\webapp\templates-hidden\default.html
(2) Again looking at the source of:
http://dev.sencha.com/deploy/dev/examples/restful/restful.html
I assume I should add lines:
<div class="container" style="width:500px">
<div id="user-grid"></div>
</div>
to file:
C:\www\lift\proj001\src\main\webapp\index.html
in order to display an ExtJS GridPanel on the page.
(3), (4) I also would like to know how to modify the following *.scala
files:
C:\www\lift\proj001\src\main\scala\code\model\User.scala
C:\www\lift\proj001\src\main\scala\bootstrap\liftweb\Boot.scala
in order to persist the data in a Postgresql database (rather than in
H2 - which I believe lacks the "D" in ACID).
I have more background in database programming than in object-oriented
programming, so I tend to think in terms of first defining tables (in
SQL), and then defining classes. Web app frameworks (eg, Lift, Rails)
tend to go in the opposite direction: defining classes first, and
generating SQL table definitions from the class definitions.
I've followed the Lift examples where the programmer defines scala
classes for data and lets the framework generate the table definitions
- using the Mapper or Record libraries. I believe this generates table
definitions for the H2 dialect of SQL. Is there a similar approach
using Mapper or Record which generates table definitions for other SQL
dialects such as Postgresql?
(5) I assume that much of this example *.js file from Sencha:
http://dev.sencha.com/deploy/dev/examples/restful/restful.js
should be copied to a new *.js file on my machine:
C:\www\lift\proj001\src\main\webapp\restful.js
In the original file 'restful.js', the following lines:
// Create a standard HttpProxy instance.
var proxy = new Ext.data.HttpProxy({
url: 'app.php/users'
});
use PHP to simulate connecting to a database stored in the session.
So these lines would need to be modified in order to use Scala/Lift
and use a connection to the Postgresql server on port 5432. This seems
like a major modification and I have no idea how to do this.
Thanks for any help.
- Stefan
PS - Do any other files need to be added to some local repositories?
Several months ago I played with Lift using Maven, and I noticed it
put a bunch of jar files into C:\Documents and Settings\abc\.m2. Now
using sbt I notice it put fewer jar files into C:\Documents and
Settings\abc\.ivy2. (This assumes that I'm user 'abc' in WinXP.)
Are all files which are needed to get started using ExtJS are included
in the sbt (.ivy2) repository? For example, do the Lift 2.1 jars
downloaded by sbt include the following implementation of interface
JSArtifacts:
http://github.com/dpp/liftweb/blob/117aada2f31e3eb2101781a5c648327568dda1e3/framework/lift-base/lift-webkit/src/main/scala/net/liftweb/http/js/extcore/ExtCoreArtifacts.scala
?
On Oct 29, 9:36 am, TylerWeir <tyler.w...@...> wrote:
> Stefan,
>
> I have an app that is fronted by ExtJs.
>
> The easiest way is to use their Restful Datastore.
>
> An example is here:http://dev.sencha.com/deploy/dev/examples/restful/restful.html
>
> Let me know if that gets you what you need.
>
> On Oct 28, 9:30 pm, Stefan Scott Alexander
>
>
>
>
>
>
>
> <stefanscottal...@...> wrote:
> > Hi -
>
> > As I continue to evaluate web application and Ajax frameworks, I keep
> > coming back to Lift and ExtJS as the best. So I want to get up to
> > speed using Lift and ExtJS for database / CRUD web apps.
>
> > The following links seem relevant:
>
> >http://github.com/dpp/liftweb/blob/117aada2f31e3eb2101781a5c648327568...
>
> >http://groups.google.com/group/liftweb/browse_thread/thread/b16c9fecd...
>
> >http://groups.google.com/group/liftweb/browse_thread/thread/7cffe4d90...
>
> > However, I'm not sure what the overall approach might involve.
>
> > Does anyone have any guidance on how to use ExtJS with Lift for CRUD /
> > database web apps?
>
> > Thanks.
--
--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to liftweb@...
To unsubscribe from this group, send email to liftweb+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.