I have an application that runs a timer script that does a click on an action button when it times out. The action button is hidden by display:none. on the action button I do a partial refresh on panelButtonBar from the onClick event. This all works great except part of what the onClick event does is sets a viewScope variable based on the condition of the document. The viewScope variable is vsIsLocked and can be either true or false. If the value is true I don't want the panelButtonBar refreshed. I created a field that does nothing called dummyField and added the following to the definition of the partial refresh:
(viewScope.get("vsIsLocked")) ? "dummyField" : "panelButtonBar"
by putting dBar.info statements in the code that is by the onClick of the action Button I know that it is running on schedule, I also know that the value of vsIsLocked has changed from true to false, but the panelButtonBar does not refresh. As I said if I take the conditional statement out and just do a partial refresh of panelButtonBar the refresh works, the conditional partial refresh does not. I believe my js correct. I tried:
(viewScope.get("vsIsLocked")) ? "" : "panelButtonBar"
but then the partial refresh seems to run as a total refresh.
You might be a little caught in "what gets refreshed when". The (viewScope.get("vsIsLocked")) ? "dummyField" : "panelButtonBar" sits in your hidden button and gets computed when that button refreshes. When you "press" the button however you either refresh the dummyField or the panelButtonBar, but not the button itself. So your condition doesn't get evaluated.
You can try put your hidden button into the panelButtonBar or target your refresh at something that includes both.
Update
The target property is only evaluated on page load, so you would need to have one button each for your refresh targets hard wired and compute the rendered property. So when it refreshes a different button is sent to the browser each time. You could use a custom control with a parameter array for the targets, so you only have one control in your UI
Related
Hi I have a button that inserts empty records into an interactive grid. I want to prevent the user from being able to double click that button because it populates duplicate rows. I have a server side argument that says if there are rows the button does not appear however they are still able to double click the Populate_tables button before it vanishes. If there are any other solutions to this please sound off. I've tried everything from javascript to server-side but they are still able to double click no matter what. Here are the before and after pictures of the table.
$('#btnPopulateTbl').dblclick(function(e){
e.preventDefault();
});
The above code prevents the double click for a button. This is in jQuery.
Oracle Apex does not offer this functionality as a setting or etc.
However you can use
$('#button').click(function(event) {
if(!event.detail || event.detail == 1){
// This will be executed once even user clicks multiple times
}
});
Note that your selector must be the id or the class you provide to this button.
By default 'add row' button's classes are:
class="a-Button a-Toolbar-item js-actionButton"
Another solution would be to have apex handle this. Suppose this is on page 1.
Create a page item P1_POPULATE_ROWS_CLICKED with a default value of 'N'
In the page process that populates the table, add the following line before the actual load:
:P1_POPULATE_ROWS_CLICKED := 'Y';
Add a condition to the page process that populates the table of "Item not equal to value", P1_POPULATE_ROWS_CLICKED , Y
Yet another solution is to only execute the insert statement if no rows exist with that condition yet. I can't show you how to do it because you didn't show how the table is populated but happy to do so if you edit your question. This last option is propably the most suitable.
I'm working on a project on grails.
I have a filter page (Filters.html) where i can perform a search with various parameters. After the search is performed the results will get displayed. (results.html)
In the results page it has a link to update a record. (update.html)
Once clicked on the update link it will take to the update html page, in that page there is a back button also there is a form so that the details can be updated and saved.
With window.history.go(-1); and window.history.back() it goes to the back page without any issue. But the issue arises when the form details are updated. When the form is submitted it comes to the same update page and shows that the records were updated. Afterward when clicked on the BACK button it goes to the same page. But doesnt go back to the results page. If i click on the BACK button twice it will go back to the results page.
I cant save the search parameters in the update page as there are several ways to go to the update.html.
Any suggestion ?
Rather than re-render the update page after a successful update you could redirect back to the results view.
update() {
// do the update
redirect( action: 'results' )
}
Or rather than have a back button, have a button that takes you directly to the results view:
<g:link action="results"><button type="button" value="Results">Results</button></g:link>
How about creating a variable called numUpdates (anything). Increment the variable when the form is updated, and have the "GO BACK" button call window.history.go(-1*numUpdates).
Change the URL of the page the form submits to, adding a parameter to the end
e.g update.html?submitted=true
Then create an if statement, that if the URL contains submitted=true (or whatever text you pick), change the back button URL to results.html.
Hope this makes sense.
If you're still stuck, I can type up the code for you
I'm using http://www.asual.com/jquery/address/
I've seen somewhere on here how to switch the hash for another value, which I've done
$.address.state('s');
This gets called once, and works fine.
I then for each page change add the ID
$.address.value( id );
Which works fine the first time. The trouble I'm having is the s get's added with each page change, i.e.
example.com/s/1
example.com/s/s/2
Any ideas how to get example.com/s/2 ?
This did it
$.address.state('/');
// switching off auto update in order to avoid adding value to the browser history
$.address.autoUpdate(false);
$.address.value(document.location.pathname+document.location.search);
$.address.autoUpdate(true);
I have client sided code in the onClientLoad event of my form that governs field hiding. Problem is, it depends on values in the first tabPanel. If I switch to the second tabPanel, it stops working. I can no longer switch back to any other tabPanel.
How can I within the onClientLoad event using CSJS identify which panel I currently am on?
In a tab panel whenever you switch between tabs the fields are recalculated.
So, I would rather suggest you to put a visibility formula on field instead.
Make sure all tab panels have a nice id. Then in your script block you can add something like:
var t1 = dojo.byId("#{id:tab1}");
if (t1) { // do your stuff }
Does it work for you?
I have an ASP.NET gridview, with the code below (modified from another stackoverflow question) to make the row clickable.
e.Row.Attributes("onclick") = Me.Page.ClientScript.GetPostBackClientHyperlink(Me.gvPricingGrid, "Select$" & e.Row.RowIndex)
I also have a button that, when clicked, flips a boolean held in the session (accessed through a code-behind property), and makes visible some textboxes in each row for updating the row. The property is called IsEditingProperty
What I want is for the onclick to work as it does now when IsEditingProperty = False, but do nothing when the property = True. I have tried the below, but the property is evaluated at render, rather than when the click actually occurs.
e.Row.Attributes("onclick") = "if (""<% IsEditingProperty() %>"") " & Me.Page.ClientScript.GetPostBackClientHyperlink(Me.gvPricingGrid, "Select$" & e.Row.RowIndex)
Is there a way to make this happen?
I ended up dealing with this by realizing that rowCreated happens on postback simply adding the check against the property there.