jQWidgets Forums
jQuery UI Widgets › Forums › Grid › how to createEverPresentRowWidget value and pass it to anther filed
This topic contains 1 reply, has 2 voices, and was last updated by Peter Stoev 9 years ago.
-
Author
-
April 7, 2016 at 12:47 pm how to createEverPresentRowWidget value and pass it to anther filed #83250
Hi,
i use showeverpresentrow and i want to create dependency between them with dropdownlist.
this is my code:
var demoApp = angular.module(“demoApp”, [“jqwidgets”]);
demoApp.controller(“demoController”, function ($scope, $http) {
$scope.createWidget = false;
$http({
method: ‘get’,
// insert json format file in here in order to load data to table.
url: ‘../jqwidgets/demos/sampledata/beverages3.txt’
//url: ‘../getRows’
}).success(function (data, status) {
// prepare the data
var VersionSource =
{ //smart_number,product_name
datatype: “json”,
datafields: [
// { name: ‘product’, type: ‘string’ },
// { name: ‘version’, type: ‘string’ },
{ name: ‘smart_number’, type: ‘string’ },
{ name: ‘product_name’, type: ‘string’ },
{ name: ‘fp’, type: ‘string’ },
{ name: ‘activation’, type: ‘string’ },
{ name: ‘platform’, type: ‘string’ },
{ name: ‘db_type’, type: ‘string’ },
{ name: ‘comment’, type: ‘string’ },
{ name: ‘expiration_date’, type: ‘date’ },
{ name: ‘local’, type: ‘string’ }
],
url: ‘/fill_jqwidget_row_data’
};// start Aviad test
var getSourceAdapterTest = function (inputProductTag) {
var source =
{
datatype: “json”,
datafields:
[
{ name: ‘smart_number’, type: ‘string’ },
{ name: ‘product_name’, type: ‘string’ }
],
// url: ‘/fill_jwidget_row_data_with_filter?test=’ + inputProductTag
url: ‘/fill_jwidget_row_data_with_filter?test=smart_number’
};var dataAdapterTest = new $.jqx.dataAdapter(source, { autoBind: true, autoSort: true, uniqueDataFields: ‘product_name’, autoSortField: ‘product_name’ });
return dataAdapterTest.records;
}var ProdTemp;
var VersionAdapter = new $.jqx.dataAdapter(VersionSource, { autoBind: true });
var inputProductTag;
var versiondd;
$scope.gridSettings =
{
width: ‘100%’,
autoheight: true,
filterable: true,
source: dataAdapter,
//columnsresize: true,
showeverpresentrow: true,
everpresentrowposition: “top”,
everpresentrowactions: “add reset”,
everpresentrowactionsmode: “columns”,
editable: true,columns: [
{
text: ‘Product’, datafield: ‘smart_number’, width: 125, editable: false, columntype: ‘dropdownlist’,
createEverPresentRowWidget: function (datafield, htmlElement, popup, addCallback) {
var inputTag = $(“<div style=’border: none;’></div>”).appendTo(htmlElement);
inputTag.jqxDropDownList({ popupZIndex: 99999999, selectedIndex: 0, source: VersionAdapter, displayMember: ‘smart_number’, width: ‘100%’, height: 30 });
return inputTag;
},initEverPresentRowWidget: function (datafield, htmlElement) {
inputProductTag = htmlElement.val();
alert(“tag1= ” + inputProductTag);
},
getEverPresentRowWidgetValue: function (datafield, htmlElement, validate) {
var value = htmlElement.val();
inputProductTag = value;
alert(“tag1= ” + value + “tag2= ” + value);
return value;
},
resetEverPresentRowWidgetValue: function (datafield, htmlElement) {
htmlElement.val(“”);
}
},{
text: ‘Version’, datafield: ‘product_name’, width: 80,
createEverPresentRowWidget: function (datafield, htmlElement, popup, addCallback) {
var inputTag = $(“<div style=’border: none;’></div>”).appendTo(htmlElement);inputTag.jqxDropDownList({ popupZIndex: 99999999, selectedIndex: 0, source: getSourceAdapterTest(inputProductTag), displayMember: ‘product_name’, width: ‘100%’, height: 30 });
$(document).on(‘keydown.product_name’, function (event) {
if (event.keyCode == 13) {
if (event.target === inputTag[0]) {
addCallback();
}
else if ($(event.target).ischildof(inputTag)) {
addCallback();
}
}
});
return inputTag;
},
getEverPresentRowWidgetValue: function (datafield, htmlElement, validate) {
var selectedItem = htmlElement.jqxDropDownList(‘getSelectedItem’);
if (!selectedItem)
return “”;
var value = selectedItem.label;
return value;
},
resetEverPresentRowWidgetValue: function (datafield, htmlElement) {
htmlElement.jqxDropDownList(‘clearSelection’);
}
},April 11, 2016 at 7:40 am how to createEverPresentRowWidget value and pass it to anther filed #83344Hi vaviad1,
createEverPresentRowWidget is called once the widget in the Grid’s ever present row area is created. It does not have the values of the other columns or dependency on the other Grid columns.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.