faulknercs / Knockstrap

Knockout bindings to twitter bootstrap 3
faulknercs.github.io/Knockstrap/
MIT License
142 stars 37 forks source link

Saving Values #43

Closed redowl3 closed 8 years ago

redowl3 commented 8 years ago

Hi, thanks for the library - very helpful, the only issue I'm having is saving information entered into a modal dialog back to the server. It looks as though it's updating the viewmodel successfully but when I save the original values are being passed back. I'm using ko.mapping.toJS to send information back.

Any ideas what I'm doing wrong?

faulknercs commented 8 years ago

Could you, please, provide example of your code, where this issue occurs?

redowl3 commented 8 years ago

Hi,

Thanks for the quick response. I think (?) I've just resolved it - I was setting the value of the label inside another ko.observable (where self.Comment is an observable)

var firstTemplateData = { text: 'text', label: ko.observable(self.Comment) };

instead using of

var firstTemplateData = { text: 'text' label: self.Comment };

Regards, Alex

On 21 April 2016 at 13:17 Artem Stepanyuk notifications@github.com wrote:

Could you, please, provide example of your code, where this issue occurs?


You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/faulknercs/Knockstrap/issues/43#issuecomment-212888297

faulknercs commented 8 years ago

So, I think, I may close this, if issue has been resolved :) Feel free to reopen, if you have questions.

redowl3 commented 8 years ago

Hi, yes it worked fine.

Quick question - is it possible to make the modal dialog box appear on hover?

On 23 April 2016 at 11:42 Artem Stepanyuk notifications@github.com wrote:

So, I think, I may close this, if issue has been resolved :) Feel free to reopen, if you have questions.


You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/faulknercs/Knockstrap/issues/43#issuecomment-213717064

faulknercs commented 8 years ago

I can suggest using of mouseover event, please, see this example: https://jsfiddle.net/faulknercs/y7f2jguu/

redowl3 commented 8 years ago

Perfect! Thank you.

On 23 April 2016 at 14:13 Artem Stepanyuk notifications@github.com wrote:

I can suggest using of mouseover event, please, see this example: https://jsfiddle.net/faulknercs/y7f2jguu/


You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/faulknercs/Knockstrap/issues/43#issuecomment-213739362

redowl3 commented 8 years ago

Hi,

Sorry to bother you again...but is it possible using Knockstrap Modal to fire an event from the close action? For example fire an ajax request to save the contents of the modal.

Any help much appreciated,

Thanks

On 23 April 2016 at 19:00 Alex Whittle alex.whittle@red-owl.co.uk wrote:

Perfect! Thank you.

On 23 April 2016 at 14:13 Artem Stepanyuk notifications@github.com wrote:

I can suggest using of mouseover event, please, see this example: https://jsfiddle.net/faulknercs/y7f2jguu/


You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/faulknercs/Knockstrap/issues/43#issuecomment-213739362

faulknercs commented 8 years ago

Hello,

Yes, it is possible via 'hidden.bs.modal' event. Please, look at this example: https://jsfiddle.net/faulknercs/5ofenepa/

redowl3 commented 8 years ago

Thanks just what I needed!

On 26 April 2016 at 13:24 Artem Stepanyuk notifications@github.com wrote:

Hello,

Yes, it is possible via 'hidden.bs.modal' event. Please, look at this example: https://jsfiddle.net/faulknercs/5ofenepa/


You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/faulknercs/Knockstrap/issues/43#issuecomment-214722367

redowl3 commented 8 years ago

Hi,

Sorry to bother you, yet again but is it possible to create mulitple events from within a modal dialog? I have a modal popup with a 'Save' button as well as the 'x' close button. By hooking up the onclose event my event is fired on both Save and Close actions, in the background I am saving to a db and looking to avoid this on just closing if possible.

Thanks again for your help.

On 27 April 2016 at 09:45 Alex Whittle alex.whittle@red-owl.co.uk wrote:

Thanks just what I needed!

On 26 April 2016 at 13:24 Artem Stepanyuk notifications@github.com wrote:

Hello,

Yes, it is possible via 'hidden.bs.modal' event. Please, look at this example: https://jsfiddle.net/faulknercs/5ofenepa/


You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/faulknercs/Knockstrap/issues/43#issuecomment-214722367

faulknercs commented 8 years ago

Hello,

Sorry for not answering so long. Yes, you can use action property of footer, if you use default template for modal footer (please, see this: https://jsfiddle.net/faulknercs/zwt96bng/, also see docs for details). Also, you can specify your own template for modal footer and use any buttons with any events with it (please, see this: https://jsfiddle.net/faulknercs/f5at5649/). Hope, this will help you.

redowl3 commented 8 years ago

Hi,

Thank you again for your help, much appreciated.

Thanks,

On 16 May 2016 at 16:29 Artem Stepanyuk notifications@github.com wrote:

Hello,

Sorry for not answering so long. Yes, you can use action property of footer, if you use default template for modal footer (please, see this: https://jsfiddle.net/faulknercs/zwt96bng/, also see docs for details). Also, you can specify your own template for modal footer and use any buttons with any events with it (please, see this: https://jsfiddle.net/faulknercs/f5at5649/). Hope, this will help you.


You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/faulknercs/Knockstrap/issues/43#issuecomment-219456137