⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Add View on same page as the CRUD



Sanaa Alauddin Khan

Sanaa Alauddin Khan
  • profile picture
  • Member

Posted 28 August 2015 - 03:26 AM

Is it possible to have Add view and then the CRUD datagrid below it. so user enters in add view and clicks save and sees it in the CRUD?


Amit Shah

Amit Shah
  • profile picture
  • Member

Posted 28 August 2015 - 08:46 AM

No one have tried it but can be possible with iframes.. and javascript @play


titu

titu
  • profile picture
  • Member

Posted 28 August 2015 - 11:38 AM

What I do is load form on modal and refresh list on close or save.


Amit Shah

Amit Shah
  • profile picture
  • Member

Posted 28 August 2015 - 11:51 AM

that surely is a good option!! 


Sanaa Alauddin Khan

Sanaa Alauddin Khan
  • profile picture
  • Member

Posted 28 August 2015 - 19:58 PM

titu, thats awesome. could you please share how its done? Thanks.


titu

titu
  • profile picture
  • Member

Posted 31 August 2015 - 15:17 PM

This would be one of many approaches:

With boostrap library loaded:

<a href="/companies/index/add"  data-target="#ajaxModal" data-toggle="modal" class="btn btn-sm">
<i class="fa fa-plus"></i> New Company </a>

And replace href with your controller/model.

 

To refresh listing I use my own plugin so not sure how it is done with ajax datatables, but just call the funciton on :
 
$('#ajaxModal').on('hidden.bs.modal', function () {
    // do something…
})

 


Noel Calonia

Noel Calonia
  • profile picture
  • Member

Posted 17 September 2015 - 02:04 AM

@titu, can you share what is the code inside those function? it would be helpful to others, and also how do you put save or button actions in your modal buttons(like in the add,edit and view button actions) or did you move those action buttons via javascript? please how? plz answer asap :(

 

thanks in advance  ;)


titu

titu
  • profile picture
  • Member

Posted 22 September 2015 - 09:14 AM

@noel no problem in sharing but could you be more specific, in what do you need. Save buttons are generated by GC template so if you load the form on the modal they will appear.


Noel Calonia

Noel Calonia
  • profile picture
  • Member

Posted 24 September 2015 - 14:27 PM

i mean that i just want to move the save button(groceryCRUD save button and other buttons) on the modal button (see the attachment)
i just want to know if this is possible, and additional problem: how to make the height and width of the iframe change when modal is in at open state? sometimes, it changes height when the record is successfully added(the successfully added message will appear at the bottom). Any idea @titu? btw, thx for the reply, i successfully show the map on the crud operation by using pure javascript provided at the biostall page. kudos! :)


titu

titu
  • profile picture
  • Member

Posted 25 September 2015 - 22:40 PM

Are you using bootstrap? this syntax should be ok. I don't use modal buttons, just the GC buttons (if not you'll have to edit the template). 

 

<a href="/companies/index/add" data-target="#ajaxModal" data-toggle="modal">
<i class="fa fa-plus"></i> New Company </a>

 

Regarding the modal length, try using this:

 

$('#modal').on('show', function () {

      $('.modal-body',this).css({width:'auto',height:'auto', 'max-height':'100%'});
});
 
In my case it wasn't necesarry but it seems that on your yes.
Snippet taken from:

Noel Calonia

Noel Calonia
  • profile picture
  • Member

Posted 27 September 2015 - 16:15 PM

@titu yes i am using bootstrap theme. i solve the height/length issue of my modal using iFrame Resizer. I just want to move the functionality of the GC buttons to my modal thats all. Thanks anyway for the suggestions   :mellow: , it is deeply appreciated ;) .