Dynamic header in Oracle Bi Publisher rtf template - oracle

In my report I have two for-each and each one must have a static text as a header.
I try this solution:
`<?xdoxslt:get_variable($_XDOCTX, 'HEADER')?>
<?start:body?>
<?for-each#section:G_1?>
<?xdoxslt:set_variable($_XDOCTX, 'HEADER', 'Group 1')?>
<?end for-each?>
<?for-each#section:G_2?>
<?xdoxslt:set_variable($_XDOCTX, 'HEADER', 'Group 2')?>
<?end for-each?>
<?end body?>`
If the two for-each are with #section it won't execute. When I leave just one with #section it runs only this one and updates the header correctly but I need both to update.

Related

Inserts something in WordPress on the theme footer when a request comes through Ajax requests?

I have inserted post meta information in the footer for archive product using woocommerce_after_shop_loop_item and wp_footer
woocommerce_after_shop_loop_item To collect the product information
wp_footer To insert information in the footer
add_action('woocommerce_after_shop_loop_item', function() {
$data = get_post_meta(get_the_ID(), 'something')
add_action('wp_footer', function() {
// generate a template using product $data and insert in the footer
})
});
But the problem is when products are loading using Ajax (load more, ajax pagination, etc) the wp_footer does not work. I can identify whether is an ajax request using the DOING_AJAX constant but the problem is when I am in PHP environment how can I insert something in the footer without page reloading?
Check the screenshot.

How to show wpDataTables results inside popup using AJAX

I am using wpdatatables to display data.
I have added MySQL Query in backend, and that query has 2 dynamic parameter like
SELECT some fields
FROM tbl1 tb1
JOIN tbl2 tb2
ON some conditions
JOIN tbl3 tb3
ON some conditions
WHERE DATE(Date) BETWEEN '%VAR1%' AND '%VAR2%';
wpdatatables Generate shortcode like [wpdatatable id=some_id] ,
I have create 2 date-picker for Start Date and End Date on Frontend.
Now I have to pass dynamic parameter like [wpdatatable id=some_id var1="strt_dt" var2="end_dt"]
So to get strt_dt and end_dt, I have call AJAX and pass parameters.
My problem is I am showing all this data inside popup.
I mean when user clicks on See Report Button
one popup will be open. Data also Displayed correctly. But it showing without wpdatatables Layout.
It is not Considering wpdatatables JS or CSS
Here is my AJAX Callback Function :
public function get_datatable_data() {
echo do_shortcode('[wpdatatable id=some_id var1="'.$_POST['strt_dt'].'" var2="'.$_POST['end_dt'].'"]');
wp_die();
}
Here is Code in which I am appending data :
var params = {"strt_dt":strt_dt,"end_dt":end_dt,action:"get_datatable_data"}
jQuery.post(ajaxurl,params,function(data){
if(data){
jQuery(".some class").empty().append(data);
}else{
jQuery(".some class").empty().append("No data Found");
}
This would have been possible if you are using normal datatable where you can re-initalize datatable on ajax success by using following code.
$("#div").dataTable().fnDestroy()
$("#div").dataTable();
But if you are using Plugin then there is no direct way to achive this, one possible solution is to create a normal page with datatable shortcode in it and then in you ajax callback you call that page in iframe.
for eg: you create page www.mysite.com/datatable - this page will have the actual shortcode
public function get_datatable_data() { ?>
<iframe src="www.mysite.com/datatable" height="200px"></iframe>
<?php
wp_die();
}
this will allow datatable to get initalize in iframe.

How to add List behavior to ReferenceManyField?

I have a list of 6k entries related to a ressource.
I would like to be able to list, search and paginate over them in a TabbedForm/FormTab. ReferenceManyField shows a limited number of entries.
What is the recommended way to extend ReferenceManyField or use List instead?
You can use the DataGrid component to large number of entries. I think there might be confusion on your part about List. List only fetches records and the actual rendering is done by DataGrid.
ReferenceManyField accepts filter, sort etc. parameters which you can use to control the number of records being fetched from your API.
According to those two issues: https://github.com/marmelab/admin-on-rest/issues/998 and https://github.com/marmelab/admin-on-rest/issues/561 you cannot use List in ReferenceManyField and the suggested way to do it is having a button that redirects you to the related List component with the proper filter.
Example:
class LinkToRelatedReviews extends React.Component {
render() {
return (<FlatButton
primary
label={ translate("Full list of reviews by user") }
icon={<ReviewsIcon />}
containerElement={
<Link to={{
pathname: '/reviews',
search: stringify({ filter: JSON.stringify({ userId: [this.props.params.id] }), page: 1 }),
}}
/>}
/>)
}
}
export default LinkToRelatedReviews;
Something like that can be put in UsersShow Component
<LinkToRelatedReviews params={props.match.params}/>
under DataGrid that doesn't provide pagination but can fetch some of the results for you.
You can also see it in action by navigating to: https://marmelab.com/admin-on-rest-demo/#/segments and clicking Customers. This will redirect you to CustomersList filtered by the specific segment.

Laravel5-update table-fill dropdown and display actual value

Being newer to Laravel 5, I am trying to update a table, then i show all fields into a form using blade. I am also able to populate the drop-down list (select) in order to show values from another table, but I can't make the drop-down to point to the value in the main table (the one am trying to update).
Controller side: I use $user to pass all user data to the view and $profiles to pass data to fill the drop-down
public function edit($id){
$user = User::find($id);
$profiles = \DB::table('profiles')->lists('desc_profile', >'id_profile');
return view('user.edit')->with('user', $user)->with('profiles', $profiles);
}
View Side:
<div class="col-xs-6">
{!!Form::select('profiles', $profiles)!!}
</div>
In addition, I can update all the fields in the table BUT the values from the drop-down ... So basically everything is working fine for show and update values except for the ones in the .... drop downs...
need help! THX a lot
You can pass an optional 3rd argument to the select method that specifies which option you want to have selected. In other words, you pass in the specific id_profile that you want selected.
<div class="col-xs-6">
{!!Form::select('profiles', $profiles, $user->id)!!}
</div>
I passed in the user id as the 3rd argument only because we have no idea how you are structuring your database, but you should adjust that to match what you need.

How to use ng-repeat with an ajax request with DataTables?

Let's say I'd like to load a dataTable dynamically, but instead of using normal ajax function within datatable, I'd like to load it through Angular, use ng-repeat to generate the tr elements and then apply DataTables. Would that be possible? In broad terms, how could I do that?
I've got the ajax/ng-repeat working already like this:
angular.module('myApp', ['ngResource', 'ui.bootstrap'])
.factory('ProjectsService', ['$resource', function($resource) {
return $resource('/customers');
}])
.controller('AdminCustomersCtrl', ['ProjectsService', '$scope', function(ProjectsService, $scope) {
$scope.projects = ProjectsService.query();
}]);
The reason I'd like to do this is that all elements (data in the table) would be binded, so whenever the user edit an entry in the table, the change would be acknowledged immediately (visually) and also saved to the REST server. Each entry in the table would correspond to a mongo db document. So if anyone has any ideas of how to achieve this differently, I'd love suggestions.

Resources