Welcome Guest, Not a member yet? Register   Sign In
Displaying invoice items
#1

[eluser]arthurhanlon[/eluser]
Hi there. I'm fairly new to Codeigniter and so far think it's awesome. Am also in the process of learning jQuery and AJAX and am loving them both too.

I am in the middle of a fairly small personal project building a returns system as a way to learn how Codeigniter works and am wondering about the best way to achieve something.

On a single return, you can have many lines for multiple products you are attaching to the return itself. At the moment, I have my controller using models to get all the returns in a the system and am using a view to display the paginated results on screen. My goal is to use jQuery to allow the user to expand the return to view all the items related to that return.

The only thing that worries me here is that I do have a little programming logic in the view file that retrieves each individual return's items and hides them in a div that can be enabled later by the user when he/she wants.

I realise it's probably best practice to have any kind of logic in the view files so am wondering how other might achieve the same functionality but without this mixing of programming logic with display logic?

Any advice much appreciated.

Cheers,
Arthur
#2

[eluser]n0xie[/eluser]
When using AJAX, it's almost impossible to seperate the business logic from your presentation layer, because your AJAX calls are basically frontend controllers.
#3

[eluser]arthurhanlon[/eluser]
Cheers for the reply but am not using AJAX for anything yet.

What I mean is that I list all the returns in a paginated list and for each return, I have a hidden div that contains the items for that return that I show/hide using jQuery.

At present, for each return I call a model from within the view to get the individual return's items which I suspect may not be the most efficient way to perform this.

Just wondering if there was possibly a better way of passing the return's items as well as the returns.

It would be very easy if I was going to a different page since I would just build the items list on the fly by passing the return's ID to the new page to view the items within that return.

I realise that this may not actually be making any sense but it's the best that I can explain, sorry Sad

Thanks,
Arthur
#4

[eluser]n0xie[/eluser]
Well in this case you can do what you want... using AJAX ;-)




Theme © iAndrew 2016 - Forum software by © MyBB