i have a toolbar which is set up like so:
MyApp.Guide.channelbar = new Ext.Toolbar({
items: [
{
text: 'loading...',
ui: 'plain',
disabled: true
}
]
});
It displays on the screen as expected, and looks just fine. So later on, i make a JSONP request and in the callback, i try to remove the loading item and insert a segmented button like so:
MyApp.Guide.channelbar.items.add(
new Ext.SegmentedButton({
name: 'testseg',
items: [{text:'test a'},{text:'test b'}]
}));
Now i'm certain that callback is getting called, because in chrome's console i do the following to confirm that the item has been added:
MyApp.Guide.channelbar.items.items[1].name
But it just doesn't get updated on the screen. What am i missing?
are you calling doLayout after adding the item?
try using the your-classthe update method of the tab panel,this will help you out
easily
Related
Essentially I have some datatable like this: Now for some reason when I go to the second page, none of the buttons I have are working. Like when I click them nothing happens! But on the first page they work perfectly! Not sure how to fix this issue! [enter image description here][1]
//creation method of the table
var volunteerTable = $('#volunteerTable').DataTable({
paging: true,
pagingType: 'simple_numbers',
columns: [ title:"First Name", title:"Last Name", title:"Email"
The trash can button code:
$('.buttonVDelete').click(function () {
//fill out the fields
//open the delete volunteer modal
//prepare data to send
}
When you use click() you are reading the elements available at the moment of loading the page.
In order to read new rendered elements, you must use on
$(document).on('click','.buttonVDelete', function () {
// Your code
});
is it jQuery required? maybe better vanilla javascript:
document.querySelector('.buttonVDelete').addEventListener('click',
function(){
})
Most of modern browser can easy deal with es5/es6
I hope I helped.
I'm working on customizing a chart I'm working on and no matter what I try anytime I try to add something in the customIcons section of the toolbar in the options for the apex chart I get the error "apexcharts:6 Uncaught (in promise) TypeError: Cannot read property 'bind' of undefined". For example, the code below works.
toolbar:{
customIcons:[],
.....
}
But if I try to actually have a custom icon it gets that error even with it blank like this.`enter code here
toolbar:{
customIcons:[{}],
}
........
When I do fill out the custom Icon sections it can properly show the custom image but it will receive that error still and no functions that happen after work including onclick functions for the Icon. I have tried looking for similar errors but I haven't seen someone have this error with apexcharts specifically any suggestions would be helpful.
in my situation what was causing it was the fact you have to have a click function defined or it will give you the bind error.
For what i'm seeing your customIcons should be placed inside tools, something like that:
toolbar: {
show: true,
tools: {
download: true,
customIcons: [{
icon: 'icon',
index: 0,
title: 'tooltip of the icon',
class: 'custom-icon',
click: function (chart, options, e) {
console.log('clicked')
}
}]
}
},
source: https://apexcharts.com/docs/options/chart/toolbar/
I'm not sure why I can't get the button element using my UI hash. This is what my Layout looks like:
Layout: App.Base.Objects.BaseLayout.extend({
// Rest of the code left out for brevity
ui: {
btnSave: "#btnSave"
},
events: {
"click #ui.btnSave": "onSave"
},
onInitialize: function () {
this.listenTo(App.vent, "DisableSaveButton", function(val) {
this.disableSaveButton(val);
},this);
},
disableSaveButton: function () {
this.ui.btnSave.prop("disabled",val).toggleClass("ui-state-disabled",val);
},
onSave: function () {
alert("saved!");
}
})
In VS2013, when my breakpoint hits the line inside disableSaveButton method, I entered $("#btnSave") into the Watch window and I was able to get the element back. I could tell because it had a length of 1. From this, I know the button is rendered. However, if I enter this.ui.btnSave into the Watch window, I would get an element with length of 0.
My BaseLayout object is basically a custom object extended from Marionette.Layout
Marionette version: 1.8.8
Any ideas why I can't find the button element using this.ui.btnSave?
Thanks in advance!
Got some help from a coworker and the issue might be because the element is out of scope. Basically, inside the Layout object, 'this' does not contain the element. We were able replace 'this.ui.btnSave' with '$("#btnSave",this.buttonset.el)' and that works fine. buttonset is the region that actually contains the html element.
This seems like an inconsistency because even though the ui hash didn't work, the click event utilizing the ui hash did work.
UPDATE 6/3/2015:
Another coworker of mine provided a better solution. Basically, in my Layout I use a display function to display my view. It looks something like this:
Layout: App.Base.Objects.BaseLayout.extend({
// Rest of the code left out for brevity
display: function() {
$(this.buttonset.el).html(_.template($("#buttonset-view").html(), {"viewType": viewType}));
}
})
Basically, I'm saying to set the html of my region, which is this.buttonset.el, to my template's html. As of now, my layout doesn't know any of the elements inside the region. It just contains a region which displays the elements. So there is some sort of disconnect between my layout and the elements in my region.
The correct solution, as opposed to my earlier workaround, is to simply add the following line of code at the end:
this.bindUIElements();
From Marionette Annotated Source:
This method binds the elements specified in the “ui” hash inside the
view’s code with the associated jQuery selectors.
So this final code looks like this:
Layout: App.Base.Objects.BaseLayout.extend({
// Rest of the code left out for brevity
display: function() {
$(this.buttonset.el).html(_.template($("#buttonset-view").html(), {"viewType": viewType}));
this.bindUIElements();
}
})
With this, I was able to finally able to retrieve my element using this.ui.btnSave.
This is first time I use the handsonTable. I am trying to have a menu button with items undo/redo outside the context menu of the handsontable, and to make those items enabled/disabled, I need to check if the undo and redo are available after the table is rendered. At my surprise, when I call the functions isUndoAvailable() and isUndoAvailable inside the afterRender handler (as stated in the documentation https://github.com/handsontable/handsontable/wiki/Methods ), it causes the undefined JS error.
Here's a jsfiddle example of what I'm trying to do :
var container = document.getElementById('example');
var hot = new Handsontable(container,
{
data: data,
minSpareRows: 1,
colHeaders: true,
contextMenu: true,
afterRender: function(isForced){
if(this.isUndoAvailable()){
// do something
}
}
});
Please have a look at this jsfiddle example. Am I doing something wrong ?
Thanks in advance.
It seems you have stumbled upon an edge case, in which the undo/redo plugin (seems) to load only after the afterRender callback.
hot.isUndoAvailable()
This works in other callbacks, at least a few I tried just now.
Here's an updated version of your fiddle, just call isUndoAvailable outside of the afterRender callback and it will work.
I have a tab panel and every tab has grid in it, but after loading, data in first tab is missing but it displays fine in 2nd tab , this is working in all the browsers in Extjs 4.2 but it is not working in Extjs 5.0 with IE. ( working fine in chrome ) thee is no errors on console. I am getting crazy with this issue. may be it is a bug in Extjs 5. Thanks in advance.
//main panel class
Ext.define('MyApp.view.MyView', {
extend: 'Ext.tab.Panel',
alias : 'widget.myView',
id : 'myView',
autoScroll : true,
activeTab: 0,
height: 600,
layout: {
type: 'column'
},
requires : [
'MyView.view.FirstTab',
'MyView.view.SecondTab'
],
initComponent : function() {
this.items = [
{
xtype: 'panel',
id: 'fTab',
autoScroll: true,
items: [ { xtype: 'firstTab' }]
},
{
xtype: 'panel',
id: 'sTab',
autoScroll: true,
items: [ { xtype: 'secondTab' } ]
}
];
this.callParent(arguments);
}
});
//controller
var isActivieTabSet = false;
// if store1 has data show the first tab
if(store1Count > 0) {
var tab0 = myView.down('#fTab');
tab0.tab.show();
if (!isActivieTabSet) {
searchSummaryView.setActiveTab(tab0);
isActivieTabSet = true;
}
} else {
myView.down('#fTab').tab.hide();
}
//check if store2 has data
if(store2Count > 0) {
var tab1 = myView.down('#sTab');
tab1.tab.show();
if (!isActivieTabSet) {
myView.setActiveTab(tab1);
isActivieTabSet = true;
}
} else {
myView.down('#sTab').tab.hide();
}
I see these issues with your code:
you should not set a layout on tab panel. Tab panel uses card layout internally, most likely it ignores any passed layout but if you set it it may be confusing for developers
you set ids on components - they are unique in the code you posted but it may not be true for the whole application. The general rule is not to manually set ids - you don't need them.
you overnest - you don't need to wrap 'firstTab' in 'fTab'. We always try to use the most shallow containment chain possible.
hiding tabs is very unusual. I'm not saying that it wouldn't work but if you need to hide a tab then you can use card layout with some simple switching logic. Tab panel is de-facto a card layout with tab "buttons" to switch the active card.
Otherwise the code does not give a clue why it should misbehave. I would suggest a) fix the above and, if it does not help b) prepare a showcase at https://fiddle.sencha.com so that I can run it and find the real culprit.
Thank you!!
1) Right , No need to specify the Layout on tab panel. I took this out
2) Right, it is a good practice to not add the Ids but we are nesting these components and show/hide by using these ids.
3) Right, that was the first thing that came to my mind, take out the wrapper panel from the grid and it works fine and show up the data but with this we have two issues.
a) In the Grid we are using 'pagingtoolbar' and shows at the botton (same in the whole application)
this.dockedItems = [ { xtype: 'pagingtoolbar', store: this.store, displayInfo: true,
dock: 'bottom' } ];
We are using the CARD layout and when we take out the panel this always shows at the botton even though the grid has only 5 records and It looks very weird and we don't want to put this on top (dock: 'top' )
b) Other issue iis sometime Column Header and data are not aligned
{header: 'Number', dataIndex: 'number', flex: 1 }
if i take out the flex:1 then all the columns get too narrow and half of the vertical space on the right is empty.
4) We have this use case that if grid does not have any data then don't show the tab. so we have to manually show/hide the tab.
Let me combine these classes & upload them (but it may time because I have to take out only the necessary objects :( ).
Thanks you again for your help!!
My Grid is inside the panel and this panel is inside the main tabpanel. if i removed the panel over the Gris then it works fine.
//this does not works (does not show data in first tab)
{
xtype: 'panel',
id: 'fTab',
autoScroll: true,
items: [ { xtype: 'firstTab' }]
},
//this works
{
xtype: 'firstTab'
}
I guess this is a bug in Extjs 5.0, same code works in Extjs 4.2 and also in Chrome.
OK, i found the solution, I have to add this on the grid.
bufferedRenderer: false,
In Extjs 5 it is true by default and it is not behaving right in IE when the Grid is inside a Panel with pagination. after this everything works great :) Thanks