How to add html in Ext.msg.confirm using extjs?
I have tried in this manner
var messageVal = 'Are you sure you want to permanently delete the selected Names "abcd11, abcdefg_test_maxim_char0, abcdefg_test_maxim_char1, abcdefg_test_maxim_char2, abcdefg_test_maxim_char3, abcdefg_test_maxim_char4, abcdefg_test_maxim_char5, abcdefg_test_maxim_char6, abcdefg_test_maxim_char7, abcdefg_test_maxim_char8, abcdefg_test_maxim_char9, abcdefg_test_maxim_chars0, abcdefg_test_maxim_chars1, abcdefg_test_maxim_chars2, abcdefg_test_maxim_chars3, abcdefg_test_maxim_chars4, abcdefg_test_maxim_chars5, abcdefg_test_maxim_chars6, abcdefg_test_maxim_chars7, abcdefg_test_maxim_chars8, abcdefg_test_maxim_chars9, abcdefg_test_maxim_chars_0, abcdefg_test_maxim_chars_1, abcdefg_test_maxim_chars_2, abcdefg_test_maxim_chars_3, abcdefg_test_maxim_chars_4, abcdefg_test_maxim_chars_5, abcdefg_test_maxim_chars_6, abcdefg_test_maxim_chars_7, abcdefg_test_maxim_chars_8, abcdefg_test_maxim_chars_9, abcdefg_test_max_chars_2, abcdefg_test_maxim_char0, abcdefg_test_maxim_char250, abcdefg_test_maxim_char260, abcdefg_test_maxim_char270, abcdefg_test_maxim_char0, abcdefg_test_maxim_char50, abcdefg_test_maxim_char60, abcdefg_test_maxim_char10, abcdefg_test_maxim_char20, abcdefg_test_maxim_char30, abcdefg_test_maxim_char40, abcdefg_test_maxim_char70, abcdefg_test_maxim_char80, abcdefg_test_maxim_char90, abcdefg_test_maxim_char100, abcdefg_test_maxim_char110, abcdefg_test_maxim_char120, abcdefg_test_maxim_char130, abcdefg_test_maxim_char140, abcdefg_test_maxim_char150, abcdefg_test_maxim_char160, abcdefg_test_maxim_char170, abcdefg_test_maxim_char180, abcdefg_test_maxim_char190, abcdefg_test_maxim_char200, abcdefg_test_maxim_char210, abcdefg_test_maxim_char220, abcdefg_test_maxim_char230, abcdefg_test_maxim_char240, abcdefg_test_maxim_char250, abcdefg_test_maxim_char290, abcdefg_test_maxim_char300, abcdefg_test_maxim_char310, abcdefg_test_maxim_char320, abcdefg_test_maxim_char330, abcdefg_test_maxim_char340, abcdefg_test_maxim_char350, abcdefg_test_maxim_char360, abcdefg_test_maxim_char370, abcdefg_test_maxim_char380, abcdefg_test_maxim_char390, abcdefg_test_maxim_char400"?';
Ext.MessageBox.confirm({
title: 'Delete Names',
msg: messageVal,
buttons: Ext.Msg.YESNO,
});
But msg is not getting viewed.
Javascript simply doesn't support modal operation,you have to use callback, Try this code
var messageVal = 'Are you sure you want to permanently delete the selected Names "abcd11, abcdefg_test_maxim_char0, abcdefg_test_maxim_char1, abcdefg_test_maxim_char2, abcdefg_test_maxim_char3, abcdefg_test_maxim_char4, abcdefg_test_maxim_char5, abcdefg_test_maxim_char6, abcdefg_test_maxim_char7, abcdefg_test_maxim_char8, abcdefg_test_maxim_char9, abcdefg_test_maxim_chars0, abcdefg_test_maxim_chars1, abcdefg_test_maxim_chars2, abcdefg_test_maxim_chars3, abcdefg_test_maxim_chars4, abcdefg_test_maxim_chars5, abcdefg_test_maxim_chars6, abcdefg_test_maxim_chars7, abcdefg_test_maxim_chars8, abcdefg_test_maxim_chars9, abcdefg_test_maxim_chars_0, abcdefg_test_maxim_chars_1, abcdefg_test_maxim_chars_2, abcdefg_test_maxim_chars_3, abcdefg_test_maxim_chars_4, abcdefg_test_maxim_chars_5, abcdefg_test_maxim_chars_6, abcdefg_test_maxim_chars_7, abcdefg_test_maxim_chars_8, abcdefg_test_maxim_chars_9, abcdefg_test_max_chars_2, abcdefg_test_maxim_char0, abcdefg_test_maxim_char250, abcdefg_test_maxim_char260, abcdefg_test_maxim_char270, abcdefg_test_maxim_char0, abcdefg_test_maxim_char50, abcdefg_test_maxim_char60, abcdefg_test_maxim_char10, abcdefg_test_maxim_char20, abcdefg_test_maxim_char30, abcdefg_test_maxim_char40, abcdefg_test_maxim_char70, abcdefg_test_maxim_char80, abcdefg_test_maxim_char90, abcdefg_test_maxim_char100, abcdefg_test_maxim_char110, abcdefg_test_maxim_char120, abcdefg_test_maxim_char130, abcdefg_test_maxim_char140, abcdefg_test_maxim_char150, abcdefg_test_maxim_char160, abcdefg_test_maxim_char170, abcdefg_test_maxim_char180, abcdefg_test_maxim_char190, abcdefg_test_maxim_char200, abcdefg_test_maxim_char210, abcdefg_test_maxim_char220, abcdefg_test_maxim_char230, abcdefg_test_maxim_char240, abcdefg_test_maxim_char250, abcdefg_test_maxim_char290, abcdefg_test_maxim_char300, abcdefg_test_maxim_char310, abcdefg_test_maxim_char320, abcdefg_test_maxim_char330, abcdefg_test_maxim_char340, abcdefg_test_maxim_char350, abcdefg_test_maxim_char360, abcdefg_test_maxim_char370, abcdefg_test_maxim_char380, abcdefg_test_maxim_char390, abcdefg_test_maxim_char400"?';
title: 'Delete Names',
Ext.Msg.confirm('title', messageVal, function(btn, text){
if (btn == 'ok'){
// add here what you need to do.
}
});
This is how you have to give
var messageVal = 'Are you sure you want to permanently delete the selected Names "abcd11, abcdefg_test_maxim_char0, abcdefg_test_maxim_char1, abcdefg_test_maxim_char2, abcdefg_test_maxim_char3, abcdefg_test_maxim_char4, abcdefg_test_maxim_char5, abcdefg_test_maxim_char6, abcdefg_test_maxim_char7, abcdefg_test_maxim_char8, abcdefg_test_maxim_char9, abcdefg_test_maxim_chars0, abcdefg_test_maxim_chars1, abcdefg_test_maxim_chars2, abcdefg_test_maxim_chars3, abcdefg_test_maxim_chars4, abcdefg_test_maxim_chars5, abcdefg_test_maxim_chars6, abcdefg_test_maxim_chars7, abcdefg_test_maxim_chars8, abcdefg_test_maxim_chars9, abcdefg_test_maxim_chars_0, abcdefg_test_maxim_chars_1, abcdefg_test_maxim_chars_2, abcdefg_test_maxim_chars_3, abcdefg_test_maxim_chars_4, abcdefg_test_maxim_chars_5, abcdefg_test_maxim_chars_6, abcdefg_test_maxim_chars_7, abcdefg_test_maxim_chars_8, abcdefg_test_maxim_chars_9, abcdefg_test_max_chars_2, abcdefg_test_maxim_char0, abcdefg_test_maxim_char250, abcdefg_test_maxim_char260, abcdefg_test_maxim_char270, abcdefg_test_maxim_char0, abcdefg_test_maxim_char50, abcdefg_test_maxim_char60, abcdefg_test_maxim_char10, abcdefg_test_maxim_char20, abcdefg_test_maxim_char30, abcdefg_test_maxim_char40, abcdefg_test_maxim_char70, abcdefg_test_maxim_char80, abcdefg_test_maxim_char90, abcdefg_test_maxim_char100, abcdefg_test_maxim_char110, abcdefg_test_maxim_char120, abcdefg_test_maxim_char130, abcdefg_test_maxim_char140, abcdefg_test_maxim_char150, abcdefg_test_maxim_char160, abcdefg_test_maxim_char170, abcdefg_test_maxim_char180, abcdefg_test_maxim_char190, abcdefg_test_maxim_char200, abcdefg_test_maxim_char210, abcdefg_test_maxim_char220, abcdefg_test_maxim_char230, abcdefg_test_maxim_char240, abcdefg_test_maxim_char250, abcdefg_test_maxim_char290, abcdefg_test_maxim_char300, abcdefg_test_maxim_char310, abcdefg_test_maxim_char320, abcdefg_test_maxim_char330, abcdefg_test_maxim_char340, abcdefg_test_maxim_char350, abcdefg_test_maxim_char360, abcdefg_test_maxim_char370, abcdefg_test_maxim_char380, abcdefg_test_maxim_char390, abcdefg_test_maxim_char400"?';
Ext.MessageBox.confirm('Delete Names', messageVal, function(btn){
if(btn === 'yes'){
//necessary actions
}
});
Here is the fiddle link
https://fiddle.sencha.com/#view/editor&fiddle/2gps
Ext.MessageBox.confirm accept parameters in following format
confirm( title, msg, [fn], [scope] )
title : String
The title bar text
msg : String
The message box body text
fn : Function (optional)
The callback function invoked after the message box is closed. See show method for details.
scope : Object (optional)
The scope (this reference) in which the callback is executed.
You can check with following working Fiddle.
Related
Since member.guild.roles.get('roleName') no longer works. I'd like to know if there's an alternative to it.
message.guild.roles.cache.find(role => role.name == 'My Role Name') is not an option, since I don't have access to message object inside the 'guildMemberAdd' handler.
My code works fine using the role id, but I'd like to make it usable for other servers.
** updating my question
This is my code:
const role1 = 'the id number here'; ---> this one I'd like to be by name
const role2 = 'the id number here');
if (collected.first().emoji.name === '😎') {
member.roles.add(role1);
} if (collected.first().emoji.name === '🟩'){
member.roles.add(role2);
} else { return}
You can access the guild from GuildMember
client.on('guildMemberAdd', member => {
// member.guild.roles.cache.find(...) - Callback similar to Array#find()
// member.guild.roles.cache.get(...) - string id parameter only
});
I have a function called updateAnswer with multiple dynamic parameters.
updateAnswer(key, answer, array = false) {
if (array) {
if(this.answers.contains.find(element => element === answer)) {
//Delete item from array if already element already exists in this.answers.contains array.
} else {
Vue.set(this.answers, key, [...this.answers.contains, answer]);
}
} else {
Vue.set(this.answers, key, answer);
}
},
I'd like to know how delete an item in the array if the value already exists in the array.
You can use method called splice:
Just reference on your array and set values in the brackets the first is referenced on the position, the second is how many datas you want to splice/delete.
The function looks like this:
this.array.splice(value, value)
Lets see on an example - you have array food= [apple, banana, strawberry] than I'm using this.food.splice(1,1)..
my array looks now like this food = [apple, strawberry] - first value in my brackets are the position, the second one is the amount of "numbers" you want to delete.
Hopefully this helps you out!
I suppose each value in this.answers.contains is unique?
Anyways, if you just want to delete the item if already exists, I suggest filter(). It should look like below:
if(this.answers.contains.find(element => element === answer)) {
this.answers.contains = this.answers.contains.filter(c => c !== answer)
}
Also, the if condition if(this.answers.contains.find(element => element === answer)) could also be replaced by if(this.answers.contains.includes(answer))
Hope that could help you.
I am using a v-chip-group with v-chips to represent a tag cloud for records in my database. I have an object array with records that look something like { key:'device', count:100}. A record could have multiple tags, so as you click on a tag, a new query is made that filters on that tag, the result will then have a new tag cloud with a subset of the previous.
It looks something like this:
tag1 (1000), tag2 (100), tag3 (100)
When you click on tag1 you end up with:
tag1 (1000), tag3 (15) (no tag2 because there is no overlap between tag1 and tag2).
Here is the relevant template code:
<v-chip-group v-model="selectedTag" multiple #change="refresh">
<v-chip v-for="tag in tags" :key="tag.key" active-class="primary">
<v-avatar left class="grey">{{ tag.count }}</v-avatar>
{{ tag.key }}
</v-chip>
</v-chip-group>
The problem I have is that in the typescript I do something like this:
refresh() {
// get simple array of tag strings
const selectedTags = this.selectedTag.map((value: any) => {
if (this.tags && this.tags[value]) {
return this.tags[value].key
} else {
return null
}
}).filter((value: any) => {
return value != null
})
Promise.all([
...
ApiCall('GET', 'tags', {limit: 1000, tags: selectedTags}),
...
).then((values) => {
// decode response from server into new tags
this.tags = values[2].series['0'].values.map((item: any) => {
return {key: item.bucket, count: item.doc_count}
})
const newTags: number[] = []
this.tags.forEach((tag, index) => {
// find the new index of the previously selected tags and save them
if (selectedTags.find(st => {
return st === tag.key
})) {
newTags.push(index)
}
})
// update selectedTag with the new value
this.$set(this, 'selectedTag', newTags)
// did not work this.selectedTag = newTags
})
}
What I'm seeing is that when I click a chip, it correctly fires the #change event and calls refresh, but then when the refresh finishes, I see an additional refresh get called with an empty selectedTag, which clears my filters and recalls the above functionality.
Is there a way to get #change to fire when a chip is changed, but not fire (or filter it out) when the event is generated by changing the data referenced by v-model?
Below is the razor markup, that i am using to get Ext.NET MultiCombo as shown in attached image
Html.X().MultiComboFor(x => x.CountryCodes).MultiSelect(true)
.Editable(false)
.QueryMode(DataLoadMode.Local)
.TriggerAction(TriggerAction.All)
.DisplayField("COUNTRY_DESC")
.ValueField("COUNTRY_CD")
.LabelWidth(80)
.FieldLabel(PR.Resources.IP.IP.Country)
.Listeners(ls => { ls.Select.Handler = "setCountryCodes();return false;"; ls.Change.Handler = "return false;"; })
.Store(Html.X().Store()
.ID("storeListCountryForPTOTR")
.AutoLoad(false)
.Model(Html.X().Model()
.IDProperty("COUNTRY_CD")
.Fields(
new ModelField("COUNTRY_CD", ModelFieldType.String) { Mapping = "COUNTRY_CD" },
new ModelField("COUNTRY_DESC", ModelFieldType.String) { Mapping = "COUNTRY_DESC" }
)
)
.Proxy(Html.X().AjaxProxy()
.Url(Url.Action("GetPriceTrendCountryForCountryDropdown", "InternalPricing")).ActionMethods(methods =>
methods.Read = HttpMethod.POST
).Reader(Html.X().JsonReader().Root("data"))
)
)
As shown in markup i am handling Select event on checkbox check/uncheck.
but this event is not getting fired when i Un-Check remaining item from list.
What could be the reason that MultiCombo is not firing the event for last item uncheck?
The Select event is meant to fire on selecting an item only, not on deselecting.
Probably, MultiCombo's Change event is what you need.
I have an ajaxfilter on a YII listview. When I select an item in the checkboxlist everything works properly: ajax calls vacature/index and gives 'vacature' the right ID which I handle in my controller, so this works fine. (vacature/index?vacature=13)
Now when I uncheck the same item it does exactly the same call, so it passes the id of the changed item. I only need it to not pass the id of the de-selected item and the string to be empty.
Thanks in advance!
echo CHtml::beginForm(CHtml::normalizeUrl(array('vacature/index')), 'get', array('id'=>'filter-vacature'))
echo CHtml::checkBoxList('niveau', (isset($_GET['niveau'])) ? $_GET['niveau'] : '',
CHtml::listData(Lov::model()->findAllByAttributes(array('wat'=>'opleiding')), 'id', 'item'),
array('class'=>'niveau','template'=>'<span class="checkbox-columns">{input} {label}</span>', 'separator'=>''))
$('.niveau').change(function(){
niveau = $('.niveau').serialize();
$.fn.yiiListView.update(
'ajaxListView',
{data: niveau}
);
});
I added a comparison to check if the string is empty, and pass the working empty value:
$('.niveau').change(function(){
niveau = $('.niveau').serialize();
if(empty(niveau))
{
niveau = 'niveau%5B%5D=0';
}
$.fn.yiiListView.update(
'ajaxListView',
{data: niveau}
);
});