Welcome Guest, Not a member yet? Register   Sign In
Bootstrap Modal (View, Edit, Delete)
#4

(12-15-2014, 06:00 AM)GrigoreMihai Wrote:
(12-15-2014, 05:42 AM)InsiteFX Wrote: You can create a MY_Model and extend all your models from MY_Model

See the CI Users Guide on MY_Model

I know that I have did it for my CI models .. this is not that much related to CI but i posted here to in the hope someone did this before.. 
When i say model i was referring to bootstrap models ....


I believe you are asking regarding http://getbootstrap.com/javascript/#modals  ?

My method to do this with as few lines of code is the following:

  1. Create a single modal for each CRUD
  2. For each item, loop with a foreach and output the buttons with the unique ID as a data attribute of the button
  3. Some JQuery to use the ID found to find the related information and then update the modal with the information

Here is a example code
Code:
$('.item-edit').on("click", function() {
    id = $(this).attr('data-item-id');
       option_text = $('span[data-option-text=' + id + ']').text();
      $('#create-modal-option-text').val(option_text);
});

For my data, I tend to put it in a span tag with data attributes but you can store the information in other places.
Reply


Messages In This Thread
RE: Bootstrap Modal (View, Edit, Delete) - by advoor - 12-15-2014, 09:55 AM



Theme © iAndrew 2016 - Forum software by © MyBB