I follow the example and create a reactiveui using dynamic data, I have no problem doing
List<TradingSy> myList = vmMwt.LoadList<TradingSy>();
_myList.AddRange(myList);
_myList.Connect()
.ObserveOn(RxApp.MainThreadScheduler)
//.ObserveOnDispatcher()
.Bind(_tradingSysCollection)
.Subscribe();
I was hoping that when a user makes multiple changes or add or remove an item, I can easily find out what the changes are with ToObservableChangeSet when a user press Save button
OKCmd = ReactiveCommand.Create(() =>
{
_myList.Connect()
//.ObserveOnDispatcher()
.ToObservableChangeSet()
.Bind(out _tradingChanges)
.Subscribe();
but it is complaing that TradingChanges is invalid
private IObservableCollection _tradingChanges = new ObservableCollectionExtended();
I believe the following will resolve the issue:
private ReadOnlyObservableCollection<IChangeSet<TradingSy>> _tradingChanges;
Related
I am Using a Script Adapter by passing payload to get contend for a Content List from "Search with values" event
When Contend get loaded to content list , i have a custom view to preview them. But if i clicked on MIME type column , It opens a separate view with the mapped viewer
So I need to remove this column or make it un-clickable
1) I am passing search values to content list's "Search with values" event , from where can i handle Content List's contend loading ,any Dojo Event i can use ?
2) With Script Adapter can i do this without going for a "response filter"
Edit :
As Nicely explained by "Ivo Jonker" (in his answer - "or try to specifically locate the widgets on your page" and with his example code)
responsed = page.ContentList8.ecmContentList.getResultSet();
var cols = responsed.structure.cells[0];
for (i=cols.length-1; i>0; i--){
var col = cols[i];
if (col.field=="mimeTypeIcon")
cols.splice(i,1);
}
page.ContentList78.ecmContentList.setResultSet(responsed);
I simply remove this row. Thanks Again and lovely blog , hope you keep posting more great articles.
The values passed through the Search With Values event will eventually be handled by the icm.pgwidget.contentlist.dijit.DocumentSearchHandler
that in turn creates a SearchTemplate to execute the search (ecm.model.SearchTemplate.prototype.search). One option would be to aspect/before/around the DocumentSearchHandler#query to manipulat the searchresults and by that way to remove the column.
The wiring however does not provide any handles to achieve this for a specific query-resultset combination leaving you to either fix this on a global scale (icm.pgwidget.contentlist.dijit.DocumentSearchHandler.prototype#query), or try to specifically locate the widgets on your page.
Personally, taking into account #2, i'd go for the responsefilter-option if you feel the global solution wouldn't be a problem, or alternatively i'd personally prefer to create a simple ICM widget that instantiates/implements a "plain" ecm.widget.listView.ContentList and exposes a wire to set the ecm.model.Resultset.
You'd then be able to create your own Searchquery in a scriptadapter, remove the column, and pass the resultset.
The script adapter could be something like:
var scriptadapter=this;
var queryParams={};
queryParams.query = "SELECT * FROM Document where id in /*your list*/";
queryParams.retrieveAllVersions = false;
queryParams.retrieveLatestVersion = true;
queryParams.repository = ecm.model.desktop.repositories[0];
queryParams.resultsDisplay = {
"sortBy": "{NAME}",
"sortAsc": true,
"columns": ["{NAME}"],
"honorNameProperty": true};
var searchQuery = new ecm.model.SearchQuery(queryParams);
searchQuery.search(function(response/*ecm.model.Resultset*/){
//remove the mimeTypeIcon
var cols = response.structure.cells[0];
for (i=cols.length-1; i>0; i--){
var col = cols[i];
if (col.field=="mimeTypeIcon")
cols.splice(i,1);
}
//emit the resultset to your new contentlist, be sure to block the regular synchrounous output of the scriptadapter
scriptadapter.onPublishEvent("icm.SendEventPayload",response);
//The contentlist wire would simply do contentlist.setResultSet(response);
});
I have a DataSource class that extends com.smartgwt.client.data.DataSource. I have several DataSourceTextFields in it that show some Strings, and I need to also show an image button in one of the columns. The problem is that if I add another field like that:
DataSourceField icon = new DataSourceField("name", FieldType.ANY, "title");
setFields(/*the other fields*/, icon);
and then upon Fetch I add all values like that:
ArrayList<Record> records = new ArrayList<Record>();
// add all records in iteration, an then add the icon one
ListGridRecord iconRecord = new ListGridRecord();
ImgButton icon = new ImgButton();
icon.setSrc("theSrc/icon.png");
// icon.addClickHandler to execute some action
iconRecord.setAttribute("name", icon);
records.add(iconRecord);
response.setData(records.toArray(new Record[records.size()]));
processResponse(requestId, response);
All of this produces a com.google.gwt.core.client.JavaScriptException: (null): null - the table shows, but with empty rows and with this error in the Console (with no more details).
I also tried to put the ImgButton in a HLayout, but I get the same error. I also tried to create a DataSourceImageField for the purpose, but then I have other errors.
Could you, please, help?
Thank you.
I'm a complete newbie at Dojo, and Adobe AIR, which is my target. I'm
trying to put some panes into an AccordionContainer like so:
var mainview = dijit.byId("mainview");
var rand = randomString();
var widg = gtd_create_entry_widget(rand)
air.trace(mainview);
air.trace(widg);
mainview.addChild(widg);
"mainview" is my AccordionContainer, and gtd_create_entry_widget() is:
function gtd_create_entry_widget(id) {
var entry = new dijit.layout.ContentPane();
entry.attr("id",id);
entry.attr("title","title "+id);
return entry;
}
The pane shows up in the container, with the correct id and title, and
no errors, however, if I try to add another pane, the next one shows
up too, but I get the error:
TypeError: Result of expression '_7' [undefined] is not an object.
I get the same error if I run
var mainview = dijit.byId("mainview");
mainview.destroyDescendants();
and also, only one pane is destroyed at a time, and I understand this
method should destroy all the children.
I can include full project code if required.
Thanks a lot
Garry
I'm not exactly sure if this is going to fix your problem, but you're supposed to use dijit.layout.AccordianPane (http://www.dojotoolkit.org/api/dijit/layout/AccordionPane.html) with the AccordianContainer.
This code used to work in WSS 3.0 / MOSS 2007 in FeatureReceiver.FeatureActivated:
using (SPLimitedWebPartManager limitedWebPartManager = Site.GetLimitedWebPartManager("default.aspx", PersonalizationScope.Shared)) {
ListViewWebPart listViewWebPart = new ListViewWebPart {
Title = title,
ListName = list.ID.ToString("B").ToUpper(),
ViewGuid = view.ID.ToString("B").ToUpper()
};
limitedWebPartManager.AddWebPart(listViewWebPart, zone, position);
}
I'm trying to convert to SharePoint 2010 and it now fails with:
System.ArgumentException: The specified view is invalid.
at Microsoft.SharePoint.SPViewCollection.get_Item(Guid guid)
at Microsoft.SharePoint.WebPartPages.ListViewWebPart.EnsureListAndView(Boolean requireFullBlownViewSchema)
at Microsoft.SharePoint.WebPartPages.ListViewWebPart.get_AppropriateBaseViewId()
at Microsoft.SharePoint.WebPartPages.SPWebPartManager.AddWebPartInternal(SPSupersetWebPart superset, Boolean throwIfLocked)
at Microsoft.SharePoint.WebPartPages.SPLimitedWebPartManager.AddWebPartInternal(WebPart webPart, String zoneId, Int32 zoneIndex, Boolean throwIfLocked)
at Microsoft.SharePoint.WebPartPages.SPLimitedWebPartManager.AddWebPart(WebPart webPart, String zoneId, Int32 zoneIndex)
Interestingly enough when I run it from a unit test it works, it only fails in FeatureActivated. When I debug with Reflector it is failing on this line:
this.view = this.list.LightweightViews[new Guid(this.ViewGuid)];
list.LightweightViews only returns one view, the default view, even though list.Views returns all of them. When running from a unit test LightweightViews returns all of my views. I have no idea what LightweightViews is supposed to mean and I'm running out of ideas. Anyone else got any?
To make it work, just do the following:
Do not set the viewguid property of the listviewwebpart object (leave it blank)
call the AddWebpart method
It will generate a new viewguid associated to a new hidden view.
Then if you want to customize this view, retrieve it from the list and customize it.
Hopefully no one ever has this problem or even sees this question. In the unfortunate event you get the same problem I have no specific solution. It eventually just started to work for me (8 hour later). I can tell you what I did right before it started working and hopefully it will help:
I went in through the UI and set the view that I was trying to set the list view web part to as the default view. I believe that's what fixed it and I have no idea why.
Some other notes on the problem:
I create all my lists and views through code
RunWithElevatedPrivileges did not help
Instantiating a new SPWeb in feature activated did not help
Setting ListViewXml = view.HtmlSchemaXml instead of setting ViewGuid made it not crash but the view was wrong when this code executed in FeatureActivated but correct when executed in a unit test.
Best I can do, sorry. If you're having this problem, good luck!
After reading this and this articles I found even more easiest solution.
When you add listviewwebpart to an any page, webpart automatically creates new hidden view in list, which is associated with this webpart (you can check it in SharePoint Manager).
When you switch view for listviewwebpart throw UI, it simply get copy of fields from selected view and push it in his hidden view.
All you need is get this view by ID, add\remove necessary fields and update view. Something like this:
var wpMngr = web.GetLimitedWebPartManager(workspaceWeb.Url + "/default.aspx", PersonalizationScope.Shared);
var attendeeListViewWebPart =
(ListViewWebPart)wpMngr.WebParts.Cast<WebPart>().FirstOrDefault(w => w.Title == Lists.AttendeesList);
var list = workspaceWeb.Lists[Lists.AttendeesList];
var view = list.Views.Cast<SPView>().FirstOrDefault(w => w.ID.ToString("B").Equals(attendeeListViewWebPart.ViewGuid, StringComparison.OrdinalIgnoreCase));
view.ViewFields.DeleteAll();
view.ViewFields.Add...
view.Update();
According to articles, you cann't update ViewGuid property for listviewwebpart.
I have been fighting with this today also.
For some odd reasons the code that you provided works for some cases but not in others.
I haven't had time to investigate more about that but what I can say is that if you are willing to use the XsltListViewWebPart (which is the replacement of the ListViewWebPart in SharePoint 2010), you will get rid of this annoying "bug".
I have just tested in myself.
Hope it helps!
I was getting this same error with an XsltListViewWebPart:
Exception: System.ArgumentException: The specified view is invalid.
at Microsoft.SharePoint.SPViewCollection.get_Item(Guid guid)
at Microsoft.SharePoint.SPList.GetView(Guid viewGuid)
at Microsoft.SharePoint.SPList.GetView(String viewGuid)
at Microsoft.SharePoint.WebPartPages.BaseXsltListWebPart.EnsureView()
at Microsoft.SharePoint.WebPartPages.BaseXsltListWebPart.get_AppropriateBaseViewId()
at Microsoft.SharePoint.WebPartPages.SPWebPartManager.AddWebPartInternal(SPSupersetWebPart superset, Boolean throwIfLocked)
at Microsoft.SharePoint.WebPartPages.SPLimitedWebPartManager.AddWebPartInternal(WebPart webPart, String zoneId, Int32 zoneIndex, Boolean throwIfLocked)
at Microsoft.SharePoint.WebPartPages.SPLimitedWebPartManager.AddWebPart(WebPart webPart, String zoneId, Int32 zoneIndex)
Since SPList.GetView is a public method, I tried it in Powershell using the Guid from my new view. It worked fine.
I figured out that the problem was the context. I had been creating my view right before the ViewGuid assignment. When I moved the creation of my view outside of the SPLimitedWebPartManager, the code ran without any errors:
SPView view = CreateHiddenView(list);
using (SPLimitedWebPartManager manager = file.GetLimitedWebPartManager(PersonalizationScope.Shared))
{
try
{
XsltListViewWebPart webpart = new XsltListViewWebPart();
webpart.ListName = list.ID.ToString("B").ToUpperInvariant();
webpart.TitleUrl = list.DefaultViewUrl;
webpart.WebId = list.ParentWeb.ID;
webpart.Title = list.Title;
webpart.ViewGuid = view.ID.ToString("B").ToUpperInvariant();
manager.AddWebPart(webpart, "Right", 1);
}
finally
{
manager.Web.Dispose();
}
}
I am trying to add my own custom select menu to the new CKEditor. The API is a little confusing so I am unsure how to get this working. I am using the ui dialog function, but really not sure how to get it working.
So far I have:
CKEDITOR.ui.dialog.select(dialogObj, elementDefinition, htmlList);
Anyone hav ideas on how to actually get a custom select to work?
I am trying understand this API: http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.ui.dialog.select.html
Try this Code,
It's something like creating the element dynamically just like in javascript, the SELECT control will be created whenever you are pressing Enter key...
var editor1 = CKEDITOR.replace('editor');
CKEDITOR.instances["editor"].on("instanceReady" , function(){
var e = this.document;
this.document.on("keyup", function(event){
domEvent = event.data;
key = domEvent.getKey();
switch(key){
case 13:
e = CKEDITOR.instances.editor.document;
b = e.getBody();
s = e.createElement('select');
o = e.createElement('option');
o.appendHtml("hi");
s.append(o);
o = e.createElement('option');
o.appendHtml("hello");
s.append(o);
b.append(s);
s.focus();
break;
default:
}
});
});
Why don't you check the _source folder?
Go into the plugins directory and pick a plugin which shows dropdown selects e.g. stylescombo. The code may shed some light into it. Create a copy of the folder and start modifying the code top down and you'll have your select in no time.
Cheers,
m^e