PDA

View Full Version : Notes View Data Into Grid



waldav00
25 Feb 2008, 10:20 AM
I am very new to the EXT libraries. Can someone tell me the steps to getting data from a Notes view into a grid? I am in a real time crunch. I have a grid working and was pulling data in from a JS data structure file using the following code:

var store = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({ url: 'crJSON.js' }),

What is the easiest way to change this to use data from a Notes view?

Thanks in advance for any help or suggestions.

David

jratcliff
25 Feb 2008, 10:56 AM
If you download the Ext.nd db from this post (http://extjs.com/forum/showthread.php?t=6829) and follow the instructions in the About document then it's as easy as:



var view1 = new Ext.nd.UIView({
viewName : 'f1',
gridConfig: {
renderTo : 'view1',
width:400,
height:200
}
});


where viewName is the name of the view in your db and renderTo is the id of an existing div on your page/form.

You can also do a full layout with an outline on the left and a view on the right like in the example on OpenNTF (http://openntf.org/extnd/demo.nsf)

Also, the zip file you download includes the demo.nsf db so you can take a look at how it is done and since the Ext.nd db is an application with a UI as well, you can take a look at how it is done.

Bottom line is that with Ext.nd, you don't have to setup your proxy, column model, data store, etc. It is done for you.

HTH,
~Jack R.

waldav00
25 Feb 2008, 1:36 PM
Thanks for your reply. I have added that code and have the proper DIV but now I get an error message that reads 'currentDatabase is null or not an object'. What does this mean?

jratcliff
25 Feb 2008, 2:04 PM
currentDatabase is a property of Ext.nd.Session which is loaded from the Session.js file which is actually an Agent in the Ext.nd db and would be loaded as "/extndDb/Session.js?OpenAgent". (where extndDb is the path to where you put the Ext.nd database on your server) Did this js file (agent) load? Did you load all of the necessary js and css files?

In the using document of the db we list two options for you in order to have your page/form load the necessary js/css files. Option 1 is to fill out an application profile form in the Ext.nd Admin database, save it, and copy and paste the corresponding @dblookup code into your HTML Head of your page/form. If you don't want to do that, then you can do option 2 and manually type into your HTML Head the @formula to get the necessary js/css files. Bottom line is that you need to make sure the necessary js/css files are loaded along with a call to Ext.nd.init() passing it the extndUrl and the extUrl.

Here's an example formula that should also be found in the Help document of the Ext.nd db you downloaded.



thisWebDbName := @WebDbName;
extUrl := "/extnd/extnd2_b1.nsf/ext/2.0.1/";
extndUrl := "/extnd/extnd2_b1.nsf/extnd/2.0.1/";
mode := @If(@UrlQueryString("debug") = "true"; "-debug"; "");
unid := @If(@IsNewDoc;"";@Text(@DocumentUniqueID));
editMode := @If(@IsDocBeingEdited;"true";"false");

"<!-- Ext JS library -->" + @NewLine +
"<script type='text/javascript' src='" + extUrl + "adapter/ext/ext-base.js'></script>" + @NewLine +
"<script type='text/javascript' src='" + extUrl + "ext-all" + mode + ".js'></script>" + @NewLine +

"<!-- Ext.nd JS library -->" + @NewLine +
"<script type='text/javascript' src='" + extndUrl + "extnd-all" + mode + ".js'></script>" + @NewLine +
"<script type='text/javascript' src='" + extndUrl + "Session.js?OpenAgent&db=" + thisWebDbName + "'></script>" + @NewLine +
"<script type='text/javascript' src='" + extndUrl + "UIDocument.js?OpenAgent&db=" + thisWebDbName + "&unid=" + unid + "&editmode=" + editMode + "'></script>" + @NewLine +
"<script type='text/javascript'>" + @NewLine +
" Ext.nd.init({extndUrl : '" + extndUrl + "', extUrl : '" + extUrl + "'});" + @NewLine +
"</script>" + @NewLine +

"<!-- CSS resources -->" + @Newline +
"<link rel='stylesheet' type='text/css' href='" + extUrl + "resources/css/ext-all.css' />" + @NewLine +
"<link rel='stylesheet' type='text/css' href='" + extndUrl + "resources/css/domino.css' />"


So make sure you are loading these js/css files AND that you make the call to Ext.nd.init()

Oh, and make sure you read and did the "Getting Started" section in the Using document of the Ext.nd database. Depending on your environment you may need to sign the db with an id that has rights to run unrestricted lotuscript agents.

waldav00
25 Feb 2008, 6:52 PM
Thank you so much, that got everything working for me. Much appreciated!

jratcliff
25 Feb 2008, 8:19 PM
fantastic! Make sure to visit this forum often and let us know of any issues you find and to keep up with the latest happenings with Ext.nd

~Jack R.