Durandal modal in modal issue - javascript

I'm trying to call custom modal inside modal and catch the retrieving data. So I'm receiving second modal's data inside first modal, but the first modal's buttons crash for parent viewmodel and does not send data, even can't click on buttons, no effect. In case if you don't open second modal, firsts buttons work correctly. I mean "save" and "cancel" buttons, what are default in Durandal modal.
Is this my code issue or it's impossible to do on that way in Durandal 2.0?
If it's possible in Durandal, I'll go to put some code here.

Related

Changes in Boostrap modal changes the different scope variable

I have an application wherein when i click on edit button it pops up a bootstrap modal where I can edit the data. But the problem is when i change any data in the bootstrap modal, the data in the list also gets changed. Strange thing here is both the scope variable for modal edit data and the scope varaible associated with the data in the page is different.
This issue can be visualized using the below URL:
http://angularjs.mostlikers.com/curd-operation/
Click on the Edit button and try to change the modal data, it also changes the data in the table which should not be the ideal case until submit is clicked.
Any help would be appreciated, since stuck for a long time.
You should clone the row object when sending it into modal, You can use lodash.js library for that like below
//When binding row to the modal's scope you should do this,
$scope.user = _.merge({},row)
Assuming that $scope is the modal's scope and row variable in the object for that row which is to be edited.

Sorting called Muliple times Using igGrid on igDialog Ignite UI Control

I am Using Ignite UI Control I am facing a sorting issue
Let me explain the scenario
I am opening an igDialog and in that dialog box I am opening a Grid view using igGrid which looked like below
Fig(1)
For the first time it working fine now when I click on each column is grid sorting is executed once but when I clicked on the add button the I replace the the dialog contents with the add content now this dialog box will be look like that.
Fig(2)
When click on the cancel button Above it again load the content of listing view and show Fig (1).
The problem I faced is actually when I clicked on any column it called the sorting function twice and it hit my controller action twice.
No of times I go to add view and then back to list view it called sorting multiple times.
Now I don’t know what's happening here ?
Note : I am using $(gridId).igDialog("content", html); to loaded content dynamically
It would be better if you can include the code which handles the view changes inside the dialog. What you're describing sound like grid events are attached multiple times on the same elements. If you're not disposing the grid, or attaching custom events every time it's shown, then this would be the result.
I will update the answer to be more concrete once you include the code in the question.

Using Blaze.render inside of a bootbox dialog - getting weird bug

So I have a bootbox dialog that I need to have a button on that will create another bootbox dialog box. My issue is though the second bootbox dialog has a lot of javascript code so I was trying to use
Blaze.render Template.templateName, $('#dialogNode')[0]
to create the second dialog box, but this causes the second dialog box to have the same styling width as the first and disabling all buttons to be pressed (must hit esc twice to close both dialogs at the same time. If I try to render the second dialog box by following the Custom HTML example on http://bootboxjs.com/examples.html there is no issue, but I need to be able to use Blaze.render to use a certain template with its js code. Any thoughts about the error I am having? Thank you
Found my issue everyone! Both of my dialog boxes were called with the same id #dialogNode, so I just changed one of them!

How to send event on plugin?

I am using the leanModal plugin and I like to add some code, in order to meet my needs.
What I did, is to use it as a modal dialog, and I have two buttons. The one button closing the modal dialog, and it is fine. The second button is responsible to use the data inserted into the dialog, and then to close the dialog.
What I am looking now, is when I click the second button, first to validate the data, and then to close the dialog, but this functionality does not exists in the plugin. So, how can I add something like the following:
$('selector').leanModal('close');
Is there a way ?
Note : I hope that my description is ok.

jqModal close, reopen issue

A Jquery Modal is called with two form elements. There is also an option to close the modal. One scenario is that the user would close the modal, and can come back to it.
But when the user come back, the form elements do not work, and the modal just closes upon a click.
$('#test').jqmAddClose('#test');
My assumption is that when the modal closes, it destroys the elements. Thus behaving erratically.
I tried Hiding the modal rather than closing it, but this does not remove the overlay.
The other option is to assign a unique for each instance.
Any other suggestions.
Thank you.
The issue was as I noted in the question, browser deleting the elements, and not re creating them. Assigning a new id each time modal was called solved the problem.

Categories