define(['jquery','frameworkviews/BackbonePrototype','applicationPath/Module1/js/views/AppView1','applicationPath/Module2/js/views/AppView2'],
function($,BackbonePrototype,AppView1,AppView2){
function getViews(modules,type){
var views= new Array();
for ( var i = 0; i < modules.length; ++i) {
var cmd = 'views[' + i + '] = new ' + modules[i]+'View.'+modules[i]+type + "View" + '() ;';
eval(cmd);
views[i].name = modules[i];
}
return views;
}
});
We are developing a project with backbone and RequireJS. Our project is based on framework and modules architecture. The modules contribute
backbone views ( AppView1/AppView2 etc) and are dynamically loaded by the Framework using RequireJS as shown above.The problem we are facing is that
if a new module is added (e.g. Module3) then again the above framework code needs to be modified to add the Module3 views to the define block.
Is there any way to avoid such changes in the framework and how to obtain reference to that newly added module view?
Don't use eval. That's evil (no pun intended).
I'll assume this is not your real code, as you're not returning anything here.
About your problem, I think you'll find everything you need here: Variable function names in Require & Backbone.
Either solutions will suit you.
Related
I would like to get the Application name of a specific sObject. For example: I have a custom object called Candidate__c. How to get the Application name of Candidate__c programmatically?
I am open to any approach like using Schema Namespace as well.
I am answering my question. I used Schema.describeTabs() and It works perfectly, but the Doc says the DescribeTabs method returns the minimum required metadata that can be used to render apps ...
Basically, The All Tabs are not included in the list of described tabs. The results are dependent upon the apps that are available to the running user.
// Get tab set describes for each app
List<Schema.DescribeTabSetResult> allApps = Schema.describeTabs();
// Iterate through each tab set describe for each app
for (Schema.DescribeTabSetResult oneApp : allApps) {
System.debug('The tabs/objects associated with the' + oneApp.getLabel() + ' app are:');
List<Schema.DescribeTabResult> appTabs = oneApp.getTabs();
for (Integer i = 0; i < appTabs.size(); i++) {
System.debug((i + 1) + '. Tab Name: ' + appTabs[i].getLabel());
}
}
In some contexts, entities are common to a group of apps. For example, I use a list of departments in my institution for at least 4 apps (different projects that cannot and should not be merged in a single app). Another example is the type of employes or even the list of employees.
Is it possible to create an entity accessible to every app in an easy and fast way?
I searched it, but can't find any documentation about this.
Is it related to the dotnet external use?
// the app id
var appId = 42;
// create a simple app object to then access datavar appSimple =
ToSic.SexyContent.Environment.Dnn7.Factory.App(appId);
// example getting all data of content type Tagvar tags =
appSimple.Data["Tag"];
If you are working with razor and just want to access the data in code, you can create an AppDataSource and tell it what App you need. Here's some Pseudo-code:
var otherApp = CreateSource<AppDataSource>();
otherApp.ZoneId = 74;
otherApp.AppId = 203;
// do this after setting the values
var categories = otherApp.Data["Categories"];
I want to use Angular.js with the Play Framework view helper functions (e.g #helper.form(...))
How do I insert an Angular directive (e.g: ng-controller)
As I'm sure you discovered, you can't directly make a Scala Symbol with a dash like 'some-word. Instead, just wrap it:
scala> Symbol("ng-controller")
res4: Symbol = 'ng-controller
We're currently using Play Framework 2 and AngularJS.
We added a special method to handle this:
implicit class SymbolString( str: String ) {
def s = Symbol(str)
}
And then we just call it as such:
"ng-model".s -> "datasetName"
I am trying to bind treeview dynamically.
I Searched in Google and found some good links.
When I try to run in my system its showing error something like this
'System.Collections.Generic.List<ActualEstimatation.frmEstimate.ItemInfo>' does not contain a definition for 'Where' and no extension method 'Where' accepting a first argument of type 'System.Collections.Generic.List<ActualEstimatation.frmEstimate.ItemInfo>' could be found (are you missing a using directive or an assembly reference?)
Those links are
How to dynamically populate treeview (C#)
and sga101's Solutions
How to insert Datas to the Winform TreeView(C#) in effitive coding?
I searched in Google to solve the above issue but not found any solution.
Please help me to solve this issue.
Thanks in advance
i need to see more of your code but i believe what you are missing is LINQ statement.
here you can read about it and start to see how to implement in your application.
for example:
using (ServiceContext svcContext = new ServiceContext(_serviceProxy))
{
var query_where1 = from a in svcContext.AccountSet
where a.Name.Contains("Contoso")
select a;
foreach (var a in query_where1)
{
System.Console.WriteLine(a.Name + " " + a.Address1_City);
}
}
I'm trying to implement a console library that reads data from Composite C1 (global datatype called RSS Feeds) and then, foreach RSS feed, the application must retrieve rss entries from the "link" attribute and insert all entries into a global datatype called "RSSItem".
Here is what i've done:
1. Open the website composite Solution
2. Create a new Console Library Project
3. Reference Composite.dll, Composite.generated.dll, ... into my new project
4. Implement the functionnality
Here is the problem:
At the design time, i have all reference working perfectly fine, I can write my code with intellisense. But when i want to launch the project (debug | release mode), the reference to composite is not working anymore ...
"Error 15 The type or namespace name 'Composite' could not be found (are you missing a using directive or an assembly reference?)"
When i do a refresh in the project browser, intelisense works again.
Thanks for your help.
Best regards,
Jonathan
PS: sorry for my english, not my native language
For info: here is a little bit of the code:
List<MCG.RSSItem> rssItemList = new List<MCG.RSSItem>();
for (int i = 0; i < 10; i++)
{
MCG.RSSItem rssItem = DataConnection.New<MCG.RSSItem>();
rssItem.Link = rss.Link;
rssItem.RSSFeed = rssFeed.Id;
rssItem.Summary = rss.Description;
rssItem.Title = rss.Title;
rssItem.PublicationStatus = "published";
rssItem.Id = Guid.NewGuid();
connection.Add<MCG.RSSItem>(rssItemList);
}
This problem was discussed here - http://compositec1.codeplex.com/discussions/357939
The problem was that Composite C1 from a std. Windows application is not supported.
Based on this problem the feature request was created - Refactor core parts of C1 to be used in "selfhost"