Programmatic form dojo -- example? - dojo

I am new to dojo.. can anyone give me a reference of how to build a form in dojo programmatically which should contain label and a textarea
Thanks in advance

My advice is to get a copy of the Dojo API so you can view it, but usually any dojo form follows this format:
var foo = new dijit.form.xxx(/* Object */ params,
/* DomNode?|String? */ srcNodeRef);
For example:
foo = new dijit.form.Textarea({text: 'this is a text'}, "textnode");
foo.startup();

got it..have a look at this
http://jsfiddle.net/user_13g/gask3

Related

Disable the back button in navigation bar

I need to get rid of only the arrow in the navigation bar in Xamarin forms. I tried in but I didn't get a proper solution. please help me overcome this issue. Thanks in advance.
!! I NEED TO REMOVE PERMANENTLY
solutions that I'm tried up to now :
Shell.SetBackButtonBehavior(this, new BackButtonBehavior
{
IsEnabled=false
});
but still, this didn't help me
There is a easy workaround to solve this.
You could override a Icon with a transparent png file(Follow is a transparent png):
and set enabled be false as follows:
Shell.SetBackButtonBehavior(this, new BackButtonBehavior
{
IconOverride = "transparent.png",
IsEnabled = false
}) ;
Then the effect as follows:
Note: You will see that we also can tap that area, therefore we need to set enabled be false.
Based on this official sample to test that.
You can set this using the Xamarin.Forms.NavigationPage class, from within a view's code behind file. E.g. within a ContentPage's constructor.
NavigationPage.SetHasBackButton(this, false);

Kendo UI Combo Box Reset Value

I'm using the Kendo UI ComboBoxes in cascade mode to build up a filter that I wish to apply.
How do I clear/reset the value of a Kendo UI ComboBox?
I've tried:
$("#comboBox").data("kendoComboBox").val('');
$("#comboBox").data("kendoComboBox").select('');
$("#comboBox").data("kendoComboBox").select(null);
all to no avail. The project is an MVC4 app using the Razor engine and the code is basically the same as the Kendo UI example.
If you want to use select the you need to provide the index of the option. Otherwise use text
$("#comboBox").data("kendoComboBox").text('');
Example: http://jsfiddle.net/OnaBai/4aHbH/
I had to create my custom clear function extending involved Kendo UI controls like the following:
kendo.ui.ComboBox.fn.clear = kendo.ui.AutoComplete.fn.clear = function () {
if (!!this.text) {
this.text("");
}
if (!!this.value) {
this.value(null);
}
this._prev = this.oldIndex = this._old = this._last = undefined;
};
Then you can call $("mycontrol").data("kendoAutoComplete").clear(); to clear the control and have the change handler invoked when doing the following: select an item, clear and select again the previous item.
This also works:
$("#comboBox").data("kendoComboBox").value(null);
I've found these options below seem to work to reset the kendo combo box. You can run $("#comboBox").data("kendoComboBox").select() after trying two below and you should see a value returned of -1, indicating its reset.
$("#comboBox").data("kendoComboBox").value('')
$('#comboBox').data().kendoComboBox.value('')
$("#comboBox").data("kendoComboBox").select(-1)
$('#comboBox').data().kendoComboBox.select(-1)

Dynamic content in User Control [Metro app, xaml]

I'm approaching to Metro App development in this days, so please be gentle.
I have created a User Control - some buttons and textblocks- that is loaded in every page of my app. I want the texblocks to change dynamically depending on the page selected: for example one of the texblocks of the user control is the page title. How can I accomplish this?
you can go for a simple code by finding the children of the usercontrol you are adding.
xaml code
xmlns:newPage="using:TestApp"
add the page like this in say mainpage.xaml:
<newPage:TestPage x:Name="pageNew"></newPage:TestPage>
then from code behind of the mainpage ie mainpage.xaml.cs
public mainpage(){
InitializeComponent();
var newPageContent = pageNew.Content; //here content will give u the immidiete children of usercntrl
}
Now you can type cast like
(Grid)newPageContent = pageNew.content;
var TextBlockFirst = newPageContent.children[0];
and so on :) please check if the suggestion is helpful :)

Using dojo dojox/dtl in AMD outside of a widget

I want to use dojo doxox/dtl in AMD, OUTSIDE OF A WIDGET!
Currently (2012-02-10) the documentation is not updated to dojo 1.7 AMD (http://dojotoolkit.org/reference-guide/dojox/dtl.html).
In the old documentation the non-AMD example is:
dojo.require("dojox.dtl");
dojo.require("dojox.dtl.Context");
var template = new dojox.dtl.Template("Hello {{ place }}!");
var context = new dojox.dtl.Context({ place: "World" });
console.debug(template.render(context)); // Hello World!
To produce the same output with the new Dojo 1.7 framework, my solution would be to subclass "dojox/dtl/_Templated" and in the constructor of the new class set the template value to the attribute "templateString".
My question is:
Can anybody help me doing dtl templates outside of a widget without subclassing "dojox/dtl/_Templated"?
Thanks alot in advance
Wolfgang
I found the solution:
define(["dojox/dtl/_base", "dojox/dtl/Context"], function (dtl, Context) {
var compiledTemplate, templateObj, contextObj;
templateObj = new dtl.Template ("Hello {{ place }}!");
contextObj = new Context({ place: "World" });
compiledTemplate = templateObj.render(contextObj);
...

sencha touch:dynamically add/remove components to panels

i extended a panel containing
-Panel
-Toolbar with button
and i registered it as a xtype using Ext.reg().There is one more panel in which i want to add the registered xtype and did it. How can i add/remove a component/html content dynamically to the outer panel on button click.
Thanks in advance.
I hope it will help you :
var component = ...;
var position = 0;
component.insert(position, new Ext.Panel({html : "inserted"}));
component.doComponentLayout();
While an older question, you can use .add or .addDocked
http://docs.sencha.com/touch/1-1/#!/api/Ext.Panel-method-add
This is far simpler since it allows the panel to add the element and manage the height ect.