We have a common DateTimeAxis that we refer to in all our content pages with an SfChart.
<xForms:DateTimeAxis
x:Key="CommonDateTimeAxis"
AxisLineStyle="{StaticResource ChartAxisLineStyle}"
EdgeLabelsDrawingMode="Shift"
Interval="{Binding DateTimeAxisIntervalGrouping}"
IntervalType="{Binding DateTimeAxisInterval, Converter={StaticResource DataTimeAxisTypeConverter}}"
MajorTickStyle="{StaticResource ChartMajorTickStyle}"
Maximum="{Binding CurrentDataWindow.End}"
Minimum="{Binding CurrentDataWindow.Start}"
PlotOffset="12"
ShowMajorGridLines="False">
<xForms:DateTimeAxis.LabelStyle>
<xForms:ChartAxisLabelStyle
FontFamily="{StaticResource LightFontFamily}"
FontSize="10"
LabelFormat="{Binding DateTimeAxisDateFormat}"
TextColor="{StaticResource OffWhite}" />
</xForms:DateTimeAxis.LabelStyle>
</xForms:DateTimeAxis>
Note that we are binding to a ViewModel property as we change the format dynamically.
LabelFormat="{Binding DateTimeAxisDateFormat}"
On initial load of a page and viewmodel the setting of the format works fine. However if once we close the View\ViewModel then go back into any other of our View\ViewModels with sfChart (or the same one) the LabelFormat remains stuck on whatever value it was prior to closing the first View/ViewModel.
I thought I was doing something foolish with retaining instances but I then realised that if i simply declare the DateTimeAxis locally i.e. not a shared resource in a ResourceDictionary, the binding always works.
That's not expected right? FWIW I have opened an incident with Syncfusion seperately and will report anything useful back here
The reported issue has been fixed and moved to Syncfusion SfChart NuGet Version: 18.2.0.47
Related
In Polymer 1.0, I am trying to data bind a string variable {{str}} to an <iron-meta> element (tag in parent element) as follows.
This fails:
<iron-meta id="meta" key="info" value="{{str}}"></iron-meta>
The above code breaks. But the following code works (without the binding).
This works:
<iron-meta id="meta" key="info" value="foo/bar"></iron-meta>
The difference is the variable version {{str}} fails and the constant version "foo/bar" works.
Does anyone have a clue what is what is breaking the binding and how to fix it?
Edits in response to comment questions:
How does it fail? This fails silently. The values I have printed out simply do not update when I press the Login and Register buttons.
Here is a link to the code in a Github repository. See lines
You need to use an attribute binding and not a property binding
<input type="text" value$="{{str}}" />
We have a REST Service and Dojo DataGrid that does not save the changes to editable columns on the initial load -- meaning the XPage loads and changes are made. The only way the changes are saved is after the close() or revert() method for the REST service is called, then the save() method is called. The REST Service is pointing to another database on the same server, and uses the keys property:
<xe:restService id="rsVictims" pathInfo="rsVictimsData">
<xe:this.service>
<xe:viewItemFileService defaultColumns="true"
viewName="InvoiceGridVictims" contentType="application/json"
databaseName="voca\vocadatastore.nsf" keys="k28ts71zrjsw">
</xe:viewItemFileService>
</xe:this.service>
</xe:restService>
Here is the DataGrid:
<xe:djxDataGrid id="djxDataGrid1" storeComponentId="rsVictims"
autoHeight="90">
<xe:djxDataGridColumn id="djxDataGridColumn1"
label="Target" width="35px" field="victimTarget">
</xe:djxDataGridColumn>
<xe:djxDataGridColumn id="djxDataGridColumn2"
label="Oct" width="35px" field="month_10" editable="true">
</xe:djxDataGridColumn>
</xe:djxDataGrid>
It flows like this:
Open the XPage with the REST service and DataGrid
Make changes to the editable columns
Click the Save button which calls this code (code is copied from Brad Balassaitis' demo, 06 Custom Control):
<xp:button value="Save Changes" id="victimsSaveButton">
<xp:eventHandler event="onclick" submit="false">
<xp:this.script><![CDATA[// Save the changes...
editedRows = [-1];
var args = {onError: function() {alert('error!');}};
rsVictims.save(args);
//Refresh the grid
rsVictims.close();
dijit.byId('#{id:djxDataGrid1}')._refresh();]]></xp:this.script>
</xp:eventHandler>
</xp:button>
DataGrid is closed, refreshed, but changes are NOT saved
Make changes again and click the Save button
DataGrid is closed, refreshed, and changes are now saved
What I have noticed is that the DataGrid is loaded twice when the XPage is opened -- I see this is Firebug in the Net tab. On the first GET, it retrieves the grid correctly -- the Response is correct, the JSON is formatted correctly, and the start=0 with a count=25.
On the second GET, it seems to lose the grid -- the Response is empty, the JSON items is empty, and the start=25 with the count=25. I have tried setting the start property in the REST Service to 0, but that does not do anything. I have tried setting the count property to 500 as well, but that does not fix it either.
The interesting fact about this is, when the view is moved inside the current database -- so the databaseName property on the REST Service is not used -- the Save button works perfectly. Also, there is only one GET when loading the DataGrid, not two GETs when pointing to a view in another database on the same server. I know there are some issues when looking to another server, but these databases are on the same server.
I know I have posted about this topic before, but I did not get an answer that worked. I am hoping this sheds some more light on what I may be missing.
Thanks in advance!
Dan,
I have nearly an identical situation in my current project. I have mine working perfect so I think I can help. I assume that you already took Per Lausten's suggestion in your previous SO. You wouldn't be able to save at all if you didn't.
The difference between your code and mine is that I am using a xe:viewJSONService instead of a xe:viewFileItemService. The extention library book says that you have to use the viewFileItem if you want it updatable, but this is NOT true.
I had nothing but trouble with the viewItemFileService, see this blog post for the issues I had (http://notesspeak.blogspot.com/2013/07/going-with-extjs-grid-and-giving-up-on.html) I nearly gave up entirely on the dojo grid, but came back to it because it works on mobile.
Using the viewJSONService just works. Instead of a keys property, use the category filter. For you category have code similar to this:
var category:String = lineItemBean.getThisUNID();
if(category == null){
return "show nothing"
} else {
return lineItemBean.getThisUNID();
}
//prevents all records from being returned
You need to be careful, because if the category is null, all records are returned, which could be a big problem or security hole. In my example, I pull from a bean, but you could put a document reference there as well.
The default Windows 8 project template has a CollectionViewSource in the template.
<CollectionViewSource
x:Name="itemsViewSource"
Source="{Binding Model.Invitations}"
d:Source="{Binding Invitations, Source={d:DesignInstance Type=vm:DesignerFilteredInvitations, IsDesignTimeCreatable=True}}" />
Obviously not all pages have a collection as their model, you can define a DataContext like this:
<vm:MySingleItemViewModel x:Key="Model" />
How do you define the design instance for this kind of model?
Well, design time data is best accomplished like this: http://blog.jerrynixon.com/2012/08/most-people-are-doing-mvvm-all-wrong.html
I realize your question is asking about using d:DesignInstance which also works with this type of technique - just not demonstrated in that article.
All it requires is a good constructor.
Okay, using this works fine:
<Page
d:DataContext="{d:DesignInstance Type=Models:ViewModel, IsDesignTimeCreatable=True}"
And using this works fine:
<d:Page.DataContext>
<Models:ViewModel/>
</d:Page.DataContext>
I must tell you the latter is an easier approach, too. It is also what Visual Studio will generate when you setup a data source in the designer. It also gives you fully-typed bindings. But either is acceptable.
Another note. I can see no good reason to set an object directly to the source of a CollectionViewSource. Normally you would be binding the CVS's Source property to a property inside your ViewModel. But, given your question: Here's how:
<CollectionViewSource
x:Name="TestCVS" Source="{Binding}"
d:DataContext="{Binding Source={d:DesignInstance Type=Models:ViewModel, IsDesignTimeCreatable=True}}"/>
Binding to the Source in the designer caused me endless trouble. But it irritated me more because I knew I would never do it this way. This is what I wanted to do:
<d:Page.DataContext>
<Models:ViewModel/>
</d:Page.DataContext>
<Page.Resources>
<CollectionViewSource x:Name="TestCVS" Source="{Binding}" />
</Page.Resources>
You better have a great reason for your approach!
Best of luck!
Usually using Visual Studio's debugger is a breeze. Scanning through Locals quickly shows the values of variables, etc. However, I'm at a loss how to find out the values contained in session state variables? Can anyone give me a hand?
Let's say I put a breakpoint right after:
Session["first_name"] = "Rob Roy";
How do I view the value contained in Session["first_name"] from locals?
It's pretty simple to inspect the session during debug. Just put a breakpoint in your code and just highlight your Session code (eg. highlight: Session["first_name"]) then right click and select QuickWatch....
This will setup up a watch on your Session for the value you had defined. You can also inspect other Session elements by adjusting the Expression field in the QuickWatch window and clicking the Reevaluate button.
In VS you can just put 'Session["first_name"]' in the Immediate Window and execute while the code is running. That will return the value that it holds.
If you can't find it go to: View > Other Windows > Command Window, or press Ctrl+W, A
It will look like this:
I know its a bit of a late reply but for anyone else who is interested, I hope this helps!
Isn't it HttpContext.Current.Session("..."), I ask as I haven't used ASP.NET for a long time.
I have created a configuration section designer project to represent nodes of a custom section necessary to read and save from my web application. I am able to successfully create instances of the configuration elements and collections, however when I save the configuration using the referenced System.Configuration.Configuration object and issuing save, the elements get merged into their parents as attributes. An example of the issue is outlined below:
After calling the referenced Configuration.save, the output is as follows:
<savedReports xmlns="SavedReportSchema.xsd">
<resultsSets dataViewId="1" id="4203bb88-b0c4-4d57-8708-18e48f0a1d2d">
<selects keyId="1" sortOrder="1" />
</resultsSets>
</savedReports>
As defined in my configuration section designer project (confirmed by the resulting xsd as well) the output should match the following:
<savedReports xmlns="SavedReportSchema.xsd">
<resultsSets>
<savedReport id="1">
<selects>
<select keyId="1" sortOrder="1"/>
</selects>
</savedReport>
</resultsSets>
</savedReports>
Any ideas? The element collection types are set to BasicMapAlternate however when I set them to AddRemoveClearMapAlternate they are not merged but they are prefixed by "add" rather than "select" or "savedReport" causing the validation to be off.
Turns out AddRemoveClearMapAlternate was the option I needed to correct my problem referenced in the question.