jasonhinkle / phreeze

Phreeze Framework for PHP
http://phreeze.com/
GNU Lesser General Public License v2.1
377 stars 166 forks source link

independent crud operation template #119

Open harinanda opened 11 years ago

harinanda commented 11 years ago

hi, i don't want to display listview. i want disply create/new,update,delete separately in each subnav or tabs.i don't want to display in modal i.e bootstrap.can u help

jasonhinkle commented 11 years ago

Well, the back-end REST controllers already have all of the data functions separated out so it's not really too difficult to do what you want. But, of course it's just a matter of writing the code.

You have the choice to keep backbone.js, REST and everything rendered on the client side. Or you can even go with a traditional style where your data is rendered in the server-side templates. There's really so many ways to do it, it depends on your particular application and whether you prefer writing more PHP code, or you prefer writing more Javascript code.

There isn't really a specific question for me to answer, but I would say if you haven't watched the training video about "views" then that might give you some good ideas on how to start because it shows a really simple way to display and update data.

titu00 commented 11 years ago

Hi I haven't been working with phreeze but I think I have a new project where I could use it so I think this week I will work on something like that. It's my intention to start working on some other templates, because I need mulltiple selection on the listview so I will take out the click event on the TR and add an Action column with edit and delete.

xzegga commented 11 years ago

You can disable clickeable tr in scripts/app/tablename.js in:

// make the rows clickable ('rendered' is a custom event, not a standard backbone event)
        this.collectionView.on('rendered',function(){
        // attach click handler to the table rows for editing
        $('table.collection tbody tr').click(function(e) {
            e.preventDefault();
            var m = page.documentos.get(this.id);
            //page.showDetailDialog(m);
        });

Comment page.showDetailDialog(m); line to disable this function. aditionally you can modify the template file to include more columns to place new action buttons.

diegolaz commented 9 years ago

Sorry, know this is an old post (almost 2 years) but its exactly the same case.,,, I already have disabled all the lines of the tr click event, and added 2 columns with buttons. The buttons never get clicked because the whole row is still being "hovered" (changes color and hand cursor) so there is something preventing my buttons action... is there a way to handle this new buttons? I added this code in the document ready after page.init(); $( ".btnVer" ).on( "click", function() {

            var id_ = $(this).attr("alt");

            alert("View details");

        });

        $( ".btnAnular" ).on( "click", function() {

            var id_ = $(this).attr("alt");

            alert("Delete");

        });

jasonhinkle commented 9 years ago

My guess is that you should put your listener code inside page.init where the old click handler was, it needs to look like this:

this.collectionView.on('rendered',function(){
    /// your code here
});

The reason your code is not working is probably because you are adding the listeners before the table is actually rendered. Plus, the table will re-render any time it is sorted or you go to the next page, so that is why you have to add the listeners after the render event.

Alternatively you could add a "live" listener to the container div for the table.