Adding data to another table from devexpress searchlookupedit - entity-framework-6

I just started devexpress and entity framework codefirst.
searchDelivery.DataBindings.Add(nameof(searchDelivery.EditValue), _item, nameof(_item.Delivery), true, DataSourceUpdateMode.OnPropertyChanged, null);
searchProduct.DataBindings.Add(nameof(searchProduct.EditValue), _item, nameof(_item.Stock), true, DataSourceUpdateMode.OnPropertyChanged, null);
I can save the data in it only with this command. Is there any other way to this?

Related

Is there alternative available to jqx render capability - $gridContainer.jqxGrid('render')

We are using jqxGrid library from jqwidgets. In this I am using jqxDropDownList for displaying list created from json data and upon selecting a value from dropdown filtering should happen.
We had some UI issues hence we had to remove below line, now I would like to know is there alternative available for below code :
code :
$gridContainer.jqxGrid('render')
if you want to update two-way data then you should used observableArray()
here check the demo code jqx observable array
var observableArray = new $.jqx.observableArray(
[{name: "Andrew Smith"},
{name: "Gordon Brown"}],
function(changes)
{
// handle changes here.
});

WebGrid is returing an error "Column does not exist"

I have the following web grid inside my Razor view on asp.net MVC 5 and i am using Entity framework 6.0:-
Now the web grid is working well on all the paging except for one paging, and when i checked it i found that the WebGrid will return this error:-
Column "SDUser.Department.Definition.DEPTNAME" does not exist.
So seems some items inside this page does not have those navigation properties SDUser.Department.Definition.DEPTNAME,, so how i can overcome this issue?
EDIT:- Here is my updated code, where i added If/Else but still i am getting the same error:-
Before adding new WebGridColumn in gridcolumns, you check whether DEPTNAME property is there or not.
#if(#Model.Content.FirstOrDefault().SDUser.Department.Definition.HasProperty("DEPTNAME"))
{
gridcolumns.Add(new WebGridColumn()
{
ColumnName = "SDUser.Department.Definition.DEPTNAME",
Header = Html.DisplayNameFor(model => model.Content.FirstOrDefault().SDUser.Department.Definition.DEPTNAME).ToString(),
CanSort = true
});
}
Additionally, if you want to check its value is there or empty then use this
#if(#Model.Content.FirstOrDefault().SDUser.Department.Definition.HasProperty("DEPTNAME") && #Model.Content.FirstOrDefault().SDUser.Department.Definition.GetProperty("productSalePrice").Value != String.Empty)
{
//your code
}
Note: I don't know actually your hierarchy of Model, I consider that specific page has not DEPTNAME property. (you are free to modify according to your requirement)

How to change configuration option in Kendo UI ASP.Net MVC

We're using Kendo UI via MVC wrappers.
Here's how we create a MultiSelect:
#(Html.Kendo().MultiSelect()
.Name("filterUsers")
.DataTextField("Text")
.DataValueField("Value")
.Placeholder("Select users...")...
The problem is that in new version of Kendo UI there's an option clearButton which has no wrapper in MVC.
How can we set it while continue using MVC wrappers? I tried:
1) Data attributes (data-clear-button), but it doesn't work since it requires all settings to be defined via attributes and the widget to be created via kendo.Bind
2) Altering configuration via setOptions, which doesn't work:
$(function() {
var s = $("#multiselect").data('kendoMultiSelect');
s.setOptions({clearButton: false});
});
Any suggestions?
The suggestion of DontVoteMeDown can work for specific MultiSelects, but needs a modification:
$("#multiselect").data("kendoMultiSelect").wrapper
.find(".k-multiselect-wrap > .k-i-close").css("display", "none");
Otherwise the previously suggested implementation will also hide the close buttons for any pre-selected items.
If you want to target all MultiSelects, then use one of the following instead:
CSS
.k-multiselect-wrap > .k-i-close {
visibility: hidden;
}
or
JavaScript
// execute this before any MultiSelects are initialized
kendo.ui.MultiSelect.fn.options.clearButton = false;

How to add custom header for new datatables with jquery-ui integration?

I want to migrate DataTable initialization to newest version. But I didn't find any possibilities to implement custom header in declarative way. dataTables.jqueryui.js is included.
Obsolete way:
DataTable {
bJqueryUI: true,
sDom: '<"H"<"#custom-id">f>t'
}
I could repeat this behaviour only with this spike:
DataTable {
dom: '<"fg-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix"<"#tInfo">f>t'
}
How can I clarify, that I want to add header in a new way?
DataTables live - http://live.datatables.net/petupeto/1/edit?html,js,output
Fiddle - http://fiddle.jshell.net/2syoa2gv/
I made some researches and found that dataTables.jqueryui just extends default settings of datatables.
$.extend( true, DataTable.defaults, {
dom:
'<"'+toolbar_prefix+'tl ui-corner-tr"lfr>'+
't'+
'<"'+toolbar_prefix+'bl ui-corner-br"ip>',
renderer: 'jqueryui'
} );
so there is no any ability to make custom header with jquery-ui integration in new way

How do I bind the column with the property?

I'm trying connect slickgrid and breeze.js, but I got a problem.
breeze generates the js model for you, and the object properties has get and set methods like:
var p1 = myobj.property1();
var p2 = myobj.property2();
myobj.property1("Test");
But in the slickgrid columns model, how do I bind the column with the property?
columns : [
{
id: "id",
name: "ID",
field: "property1" //this way I only see for every row on the page the text "function..."
},
{
id: "prop2", name: "prop2", field: "property2"
}
]
Try using the breeze "backingStore" adapter instead of the default "ko" (knockout) adapter.
This requires just a single line of Breeze configuration near the top of the file
breeze.config.initializeAdapterInstance("modelLibrary", "backingStore", true);
The backingStore adapter creates ES5 props for your model instead of "knockout" properties. I guessing that these will be easier for slickgrid to bind to.

Resources