I am new to ext js. I am trying to create a custom event in ext js inside a if else loop. Is it possible to create events inside if else loop. Kindly help me...
Particularly I want to create it inside the else loop...
Thanks in advance...
Related
is it possible to know which BLADE page you are on? I would like to include a different menu where my VIEW is the MAIN, how can I do this in the template? I check if it is my MAIN and add my different menu there if in case. example: #if(config('page.layout') == 'top-nav');
Is that possible? but with another code, of course
To me it seems like you are thinking with the wrong way. You should know what(which controller, which method) has loaded that view instead of what is this view. And you can pass control variables from there if you want.
In you question, the example you have shown:
#if(config('adminlte.layout') == 'top-nav')
So top-nav is coming form config adminlte.layout which has no relation with blade template or anything else. You can definitely do that if you set your config file based on your intention.
I wanted to pick up which file or URL my BLADE was, I got it this way:
#if(Route::current()->getName() == 'name') ....
##codeHTML
#endif
I am starting to use dropzone.js and have run into a minor problem. I am able to upload files. I use a modal popup to get the file information.
The problem is when I go back the files I previously uploaded are still in the drop zone (with checkmarks). I want an empty dropzone.
Ideas?
All the answers I've seen involve assigning a variable when you initialize dropzone. If you don't want to do this extra step and already have your dropzone element: You can use Dropzone's forElement method to directly target your dropzone without the need for any variables:
Dropzone.forElement('#myDropzoneElementID').removeAllFiles(true)
Did you tried to call the "removeAllFiles" function of your dropzone object after the upload ?
See documentation : http://www.dropzonejs.com/#dropzone-methods
In the first answer of this post, the solution is also to call the "removeAllFiles" function :
removing all manually added files from Dropzone.js?
If it doesn't solve your problem, please give us more information
With jquery you can make something like this.
var dZUpload = $('#dZUpload).dropzone({
..
})
$('.click').click(function() {
dZUpload[0].dropzone.removeAllFiles();
})
You can call removeAllFiles function to clear dropzone object before upload.So when ever you try to upload something using dropzone it will be always clear.
myDropzone.removeAllFiles();
This may help someone who could not solve the problem because of the next scenario.
When i call removeFile i catch the removedfile event to send the remove request to the backoffice. So when i use removeAllFiles it's not only the preview that is removed but also the file itself from the server.
So I came up with this solution:
//I had the request depending on a flag
this.on("removedfile", function (file, hardRemove = 1) {
if(hardRemove){
// request the server to delete the file
}
});
// I created a new event for visual reset that calls the removedfile event with the
// hardRemove flag disabled, resets the array of files and emits the reset event
// to reset the dropzone initial layout
this.on("resetFiles", function () {
for (let file of this.files) {
this.emit("removedfile", file, 0);
}
this.files = [];
return this.emit("reset");
});
So whenever i want to reset the dropzone i just call the new event:
dropzone.emit("resetFiles");
I am using Sencha ExtJs grid 4.2 . I am using a Expander plugins for my grid and try to load data under expanded region from Ajax. Right now I am using this code to show data on expanding.
plugins: [{
ptype: 'rowexpander',
rowBodyTpl: new Ext.XTemplate(
'<br><img height="31" width="32" src="../upload/patient/thumb/{patient_image}">',
' <p><b>{fname}, {lname}</b></p>',
'<br> {accordian_view}'
)
}],
Here you can see that data is pre populated, but my requirement is to load data on expanding. I am trying hard to find the event or process to do it. But still no luck. If anyone have any idea please share.
Thanks in Advance
You might check out the expandbody event on the RowExpander plugin: http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.grid.plugin.RowExpander-event-expandbody
This event passes not only the row's bound record, but also the expanded element, so you could:
Request data via Ext.Ajax.request({...})
Handle response
Add content to expanded row
One thing to keep in mind, however, is the async nature of this approach. That is, the row is going to expand immediately, regardless of how long the subsequent request takes to come back. So it would probably be a good idea to do something like this instead when handling the expandbody event:
Add "loading" text/icon/whatever into expanded row area
Make Ajax request
Handle response
Replace loading text/icon/whatever with the data returned from the Ajax request
It's likely someone has already done so, but you could also (and I would highly suggest it) wrap this process into a custom plugin of your own that extends the RowPlugin. That way you could use it elsewhere in your app for any grid. If you end up creating a custom plugin, please share it with the community!
EDIT: A quick Google revealed a number of custom plugins that do precisely this. For example: https://github.com/nickbretz/Ext.ux.AsyncRowExpander/blob/master/AsyncRowExpander.js
Im going through a version of No-frills Magento Layout (perhaps 4-5 months old) and am basically stuck right in the beginning.
In Indexcontroller, in the index action, I create a new block object.
public function indexAction()
{
//$this->loadLayout();
$block = new Mage_Core_Block_Template();
$block->setTemplate('helloworld.phtml');
//print_r($block->getTemplateFile());
echo $block->toHtml();
//$this->renderLayout();
I should then create a template file, namely helloworld.phtml and place it in the appropriate directory. I'm used to using a layout file to do this, but I am going through the book and am simply not able to render the file.
I have placed the phtml file in the following locations :
.../app/design/frontend/default/default/template
.../app/design/frontend/base/default/template
which is also the output of
print_r($block->getTemplateFile());
Im obviously missing something here. any chance someone can point it out?
cheers
Based on the comments above, I'd jump directly to to PHP file for the Mage_Core_Block_Template class
app/code/core/Mage/Core/Block/Template.php
Look for the include line and add some debugging that var_dumps whatever file Magento is trying to include OR add some debugging around the conditionals to determine why this isn't getting called.
I want to dynamically add UIElements to a dialog depending on the value of another uiElement..I believe what i need is defined here : http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dialog.definition.contentObject.html#add. unfortunately, there is no usage example..What object do i need to create to use this function? Ive tried dialog.add(), but this does not work? Can someone help me put here please?
Thanks
You can do it by using the addUIElement method.
http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dialog.html#.addUIElement
CKEDITOR.dialog.addUIElement(typeName, builder)