My list view has a string and a delete button(this is with k-delete-button class). When I press delete I need to call a special method on my viewModel. and this should not update my datasource..
I'm using my own "remove" method as below on the kendo listview.
m("div" , {
id:"listView",
"data-role": "listview",
"data-template":"template",
selectable: "multiple",
"data-bind":"source: items, events: {remove: onItemRemove} ",
})
on my view Model :
onItemRemove = (e:any) => {this.removeWavelegnthFromList(e.model); }
I'm using e.model to get the value corresponding to the item that I'm trying to delete. But this is set to a wrong value. It doesn't return the value I've selected for delete.
I couldnt use e.sender.select() method to get my value and it throw "Uncaught TypeError: Cannot read property 'value' of undefined(…)" error.
please let me know if I'm doing anything wrong.
Related
I would like to use the "setter" function from the "filteredValue" property from the Data Table (PrimeFaces) to apply custom filtering logic... The problem is that the setter function always receives a null value and, if I use the value collection to filter, the filter operation isnt reflected in the datatable !.
publiv void setFilteredOrg(List filteredOrg) {
// filteredOrg always null
// I apply custom filtering against the value
return the filtered collection but the UI isnt filtered
}
Hope I make myself understood; I fear of pasting the code... But I can see if its confusing...
in your column use filterMatchMode='custom' and filterFunction='customFilter'
customFilter is a javascript function that you defined
function customFilter(itemLabel, filterValue) {
//return true to accept and false to reject
}
I need information on how to use the PXSubordinateSelector attribute with the Where type that you can allegedly set on the attribute. Does anybody know how to use this attribute?
Specifically, I need to filter the selector by a custom field in the EPCompanyTree table if possible. Not sure what tables this selector attribute usese. It seems to be tucked into the Acumatica black box. Something like this:
[PXSubordinateSelector(typeof(Where<EPCompanyTree.customField, Equal<{somevalue}>>))]
I've tried setting the Where to an arbitrary filter on the EPCompanyTree.sortorder field but, I'm getting an "is not bound" error when clicking on the lookup.
TIA!
The reason for this error is the defined Search in the GetCommand method of the PXSubordinateSelectorAttribute. Below is the disassembled code of that method:
private static Type GetCommand(Type where)
{
Type whereType = typeof(Where<CREmployee.userID, Equal<Current<AccessInfo.userID>>, Or<EPCompanyTreeMember.workGroupID, Owned<Current<AccessInfo.userID>>>>);
if (where != null)
{
whereType = BqlCommand.Compose(new Type[]
{
typeof(Where2<, >),
typeof(Where<CREmployee.userID, Equal<Current<AccessInfo.userID>>, Or<EPCompanyTreeMember.workGroupID, Owned<Current<AccessInfo.userID>>>>),
typeof(And<>),
where
});
}
return BqlCommand.Compose(new Type[]
{
typeof(Search5<, , , >),
typeof(CREmployee.bAccountID),
typeof(LeftJoin<EPCompanyTreeMember, On<EPCompanyTreeMember.userID, Equal<CREmployee.userID>>>),
whereType,
typeof(Aggregate<GroupBy<CREmployee.acctCD>>)
});
}
As you can see from code the Search is being organized on CREmployee with left joined EPCompanyTreeMember, meanwhile, your code is trying to add a condition on EPCompanyTree field which is not participating in the Search.
I am using Select2 (4.0) in an XPage. I have a ComboBox whose value is tied to a property in a bean, and the select items are populated (for now) by a viewScope variable I populate in before page load.
The user is able to type in a new value, but when I go to save the data I am getting a validation error:
This is not a validation error that I wrote but from Xpages. Although I am able to enter a new value ("Apple") when I save the page, it displays this error and removes my new value.
I believe this has something to do with the fact that the new value is not in the list of possible values, but I am not sure.
I found other posts that suggested that I have to add the new value to the list of values before submitting the page. I tried this but it didn't work either.
I really like select2 and want to use it for all comboBoxes and ListBoxes, but there are many times where the use needs to enter new values.
Code for the comboBox:
<xp:comboBox id="model"
value="#{javascript:PCModel.model}" xp:key="field">
<xp:selectItems>
<xp:this.value><![CDATA[#{javascript:viewScope.models}]]></xp:this.value>
</xp:selectItems>
</xp:comboBox>
And my script block:
<xp:scriptBlock id="scriptBlock1">
<xp:this.value><![CDATA[$(document).ready(
function()
{
x$("#{id:model}").select2({
tags: true,
createTag: function (params) {
return {
id: params.term,
text: params.term,
newOption: true
}
;},
templateResult: function (data) {
var $result = $("<span></span>");
$result.text(data.text);
if (data.newOption) {
$result.append(" <em>(new)</em>");
}
return $result;
}
}
)
}
)]]></xp:this.value>
</xp:scriptBlock>
I am trying to use md-autocomplete in Angular Material as a multi selector. The idea is, that the selected element from the autocomplete will be added to an object array after selection and then the selection will be removed from the md-autocomplete. I was able to clear the md-autocomplete, but the focus stays on the md-autocomplete input and so the autocomplete suggestions are still visible.
Example:
http://cdpn.io/QjQGVQ
Code:
function selectedItemChange(item) {
$log.info('Item changed to ' + JSON.stringify(item));
if(item)
{
//check if item is already selected
if($filter('filter')(vm.contactsSelected, function (d) {return d.id === item.id;})[0])
{
$log.info('Item already selected. Will not add it again.');
}
else
{
//add id to object
vm.contactsSelected.push(item);
}
// clear search field
vm.searchText = '';
vm.selectedItem = undefined;
//somehow blur the autocomplete focus
//$mdAutocompleteCtrl.blur();
}
}
PS: I am aware I could use the contact chips of Angular Material instead, but I was still wondering how the blur could be achieved.
If you set md-no-cache="true" property inside your the list will dissapear, but input field will not be cleared. I think is better solution than clearing input field but leaving the list visible, but is up to you.
I am intiating a loading panel in init method and hiding it in ReturnDataPayload event.This is working perfectly when data Table has got some values in it.But when there is no data returned from database , the control is not going to returnDataPayLoad event.Please help me in finding an event which will be fired even when the response doesn't have any data or tell me a way to hide the loading panel.
If you want a custom behavior, use DataSource's sendRequest method of the dataTable's dataSource
(function() {
var YdataTable = YAHOO.widget.DataTable,
YdataSource = YAHOO.util.DataSource;
var settings = {
container:"<DATATABLE_CONTAINER_GOES_HERE>",
source:"<URL_TO_RETRIEVE_YOUR_DATA>",
columnSettings:[
{key:"id", label:"Id"}
],
dataSourceSettings:{
responseType:YdataSource.TYPE_JSON,
responseSchema:{
resultsList:"rs",
fields:[
{key:"id"}
]
}
},
dataTableSettings:{
initialLoad:false
}
}
var dataTable = new YdataTable(
settings.container,
settings.columnSettings,
new YdataSource(
settings.source,
settings.dataSourceSettings),
settings.dataTableSettings);
})();
keep in mind No matter which source is your data: XML, JSON, JavaScript object, TEXT, you always will get your data in a unified way through DataSource's sendRequest method. So when you want to retrieve your data and, at the same time, add custom behavior, use it
dataTable.getDataSource().sendRequest(null, {
success:function(request, response, payload) {
if(response.results.length == 0) {
// No data returned
// Do what you want right here
// You can, for instance, hide the dataTable by calling this.setStyle("display", "none");
} else {
// Some data returned
// If you want to use default the DataTable behavior, just call
this.onDataReturnInitializeTable(request, response, payload);
}
},
scope:dataTable,
argument:dataTable.getState()
});
The properties of the response are
results (Array): Your source of data in a unified way. For each object in the results Array, There is a property according to responseSchema's fields property. Notice i use response.results.length to verify if some data has been returned
error (Boolean): Indicates data error
cached (Boolean): Indicates cached response
meta (Object): Schema-parsed meta data
On the YUI dataTable page, look for Loading data at runtime to see some built-in functions provided by YUI dataTable
I hope it can be useful and feel free to ask for help for anything else you want about YUI. See a demo page of nice features of YUI dataTable