Joomla 1.7 custom toolbar button usage - joomla

I've added a custom button into my component's backend toolbar with this code:
JToolBarHelper::custom('libri.details','details.png','details.png','TOOLBAR_DETAILS',true);
This button needs that the admin checks one of the entries listed in the table.
You can see a screenshot here if you haven't understood what I'm talking about
The button is the one called "Dettagli" (no image at the moment).
I'm having some problems:
How do I append the checked entry's id to the address generated from the button?
I've put a details() method into the controller, it calls an instance of the model and a method inside it. The model's method returns to the controller the result of a query. How do I say to the controller to pass that result to a view called libro?

All information in the page will be sent through POST to the Joomla controller (in this case, libri). In your controller, you can use JRequest::getVar('varNameHere'); to retrieve it.
$this->setRedirect($urlOfView, $someStatusMessage)

Related

How to pass data from one page model to another page model in fresh mvmm

I have used Fresh MVMM. I need to pass a data from one page model to another page model without using init and reverse init.
Eg: I have one toggle button in first content page.
I need to toggled the button based on the selection in second popup page without popup the second PopPopupPageModel.
ReverseInit is worked when popup the second PopPopupPageModel and can easily pass data.
But I need to toogled the button in first page without popup the second page.
Please help...

Data-view is not updating when entity is updated in Mendix

Question is: How to show data in data-view in such a way that if entity is updated some how dataview is updated too.
This is my Entity named latestReading.
Here is my page LatestReading that show latest readings. It contains three data views.
This page is not called directly, as it expect a object latestReading. Hence a micro-flow named showLatestReadingPage is executed that fetches or create latestReading object and pass it to the LatestReading page and display LatestReading page.
Here is that micro-flow.
getOrCreateLatestReading is a micro-flow that returns us the a latestReading object if it is available or create a new latestReading object if it is not already created and then returns it.
Here is that micro-flow.
These are the properties of first of the three data-views in LatestReading page as shown diagram of LatestReading Page above. Name of this DataView is TemperatureDataView
These are the properties of text widget that is inside TemperatureDataView data-view. Its name is temperatureText. It shows value of temperature in the TemperatureDataView.
And this is the caption of temperatureText text widget:
Problem is when another micro-flow updates the value of latestReading the text widget is not updated. I need to reload it by clicking on navigation link of LatestReading page again.
I need my text widget in data view to keep updating value of latestReading when it is updated my some other micro-flow
The issue is that ‘refresh in client’ only works if the microflow is executed in the same context as the page (client) that the user is seeing. For example if there is a button on the page that triggers a microflow that refreshes the client then it will update the widget. However, if the microflow is triggered by the system (e.g. a scheduled event) then these changes are in a different context. Also if another user triggers a refresh it will only refresh that user’s client. Also if one user is logged in through multiple browsers (i.e. has multiple sessions, it also means that for each session there is a different user context.
The simplest solution in this case would likely be to use an appstore widget that periodically triggers a refresh on the object displayed in the dataview, such as this one: https://appstore.home.mendix.com/link/app/27/ . Simply create nanoflow or microflow with a change action that changes no attributes but refreshes the object.

CodeIgniter Persistent URL attach with every URL

In CI, I want to attach selected filter (in $_GET method)
to appear for every link I click.
This filter are persistent so is this filters selected in any page should be available for any other page in project.
For example, I selected dealerID, GroupId in one page, let's say dealer in page www.domain.com/dealers?dealerId=2&groupId=10 page, then if I click this another link named *www.domain.com/group*s the groups page should look like www.domain.com/groups?dealerId=2&groupId=10 that was selected in previous page.
And one more thing: I am using a main controller that will be inherited by all controllers for some reason.
Any help would be appreciated.
You could have one universal $data['filter'] variable that is going to preserve all variables that you need for filtering and than in view just add $filter at the end where you need it.
$data['filter'] can be collected/generated in constructor and defined by default.
It's little bit tricky solution i would rather use session to keep data of that kind and having "reset" button on page.

Hide the Partial view and show another partial view in mvc3

I have a hyperlink column in the grid. On clicking the link i have to hide the partialview(grid section) and have to show/load another partialview which is the detail section. Please provide solution
You could use javascript. With jQuery that will correspond to the .toggle() function or the .show()/.hide() functions. So basically you will subscribe to the click event of the link and inside this handler show and hide the respective sections. For this to work you should obviously place those partials inside placeholder divs so that you could show/hide the entire placeholder.
If in addition to showing the partial you need to fetch some fresh information from the server then you could use AJAX to request a controller action that will return the fresh data of the partial view that you will inject into the DOM at the correct placeholder location. In order to send an AJAX request in jQuery you could use the $.ajax() function or directly the .load() function.

how to use razor as user control

Example Scenario:
Let's say I need to create a user control which displays a list of products for specified category (CategoryID passed as input to Index GET controller).
Also, it has a "Add" button below list which calls Category Details (GET) controller (passing categoryID to controller) which displays a form with Text box and button to add new category.
Once user enters category Details and press submit, Details (POST) controller is called which saves data and should redirect user back to page from where it was called.
This user control (razor file) can be used multiple times on same page.
Queries
1) What is best approach to integrate such a control in page views such that form in every user control is self contained and doesn't conflicts with other instances of same user control in same page?
2) I tried Html.RenderAction("Index","Category",new {categoryName = "toys"})
This works well in displaying category and clicking on Add button does takes user to "Add a new category" page. Problem is, what code should I write such that I can take user back to the same view page, where the user control was embedded (even better if I can scroll window to the position where control was placed)?
thanks!
When Data is posted in a partial view to the corresponding Action , It has no context of the main view/action. So we can post data to the main action so that modelstate is preserved and can be validated.
But if you want to post data to the partial view/action, we can redirect to main view/action post product is added.(But if some invalid data is entered, we cannot display any validation error)
[HttpPost]
public PartialViewResult AddProduct(string productId,string returnUrl)
{
//Add product
return Redirect(returnUrl);
}
What you are looking for is a partial view, namely an editor template.
In your Views folder, create a Shared folder and inside that create an EditorTemplates folder. From there create a strongly typed partial view named the same as the part of the model.
Then on your main view call EditorFor.

Resources