Is it possible to display a Processing message at the beginning of a datatables table already containing data?

Within my Laravel 5.7 application, I have implemented the "yajra/laravel-datatables-oracle": "~8.0" library and found a helpful thread on customizing the processing message at this link.

I adjusted the processing message styling as follows:
.dataTables_processing {
  margin-top: -80px !important;
  padding: 70px !important;
  background: #F5F8FA !important;
  color: blue !important;
  border: 2px dotted darkgrey;
  border-radius: 3px !important;
  font-size: xx-large !important;
  opacity : 1 !important;
  text-decoration: none;
}

This modification successfully displayed the processing message when loading data on page open, however subsequent data refreshes did not show the message in the desired position.

I attempted to adjust the vertical alignment by adding the following to the existing style:

  vertical-align: top;
  vert-align: top;

This adjustment did not yield the expected result.

The HTML structure of the data area is as follows:

<div class="table-responsive">
   <div id="get-vote-dt-listing-table_wrapper"
        class="dataTables_wrapper no-footer">
      <div id="get-vote-dt-listing-table_filter" class="dataTables_filter"
           style="display: none;"><label>Search:<input type="search" class=""
                                                       placeholder=""
                                                       aria-controls="get-vote-dt-listing-table"></label>
      </div>
      <div id="get-vote-dt-listing-table_processing"
           class="dataTables_processing" style="display: block;">Loading
         votes...
      </div>
      <table class="table table-bordered table-striped text-primary dataTable no-footer"
             id="get-vote-dt-listing-table" role="grid"
             aria-describedby="get-vote-dt-listing-table_info">
         <thead>
         ...
            // Table content omitted for brevity
         ...
      </table>
      <div class="dataTables_info" id="get-vote-dt-listing-table_info"
           role="status" aria-live="polite" style="display: none;"></div>
      <div class="dataTables_paginate paging_simple_numbers"
           id="get-vote-dt-listing-table_paginate"></div>
   </div>
</div>

What would be the correct method for achieving the desired style modifications?

Uploaded block # 1

You can view a live example at this link. Log in with credentials [email protected] 111111, then navigate to this page.

The processing message should display within 1-2 seconds upon page upload. If you enter "001" in the filter field labeled “Enter Box Room No.” and click “Search”, there is a deliberate 30-second delay added for debugging purposes. Scroll down to observe the processing message...

Thank you!

Answer №1

If you want to place the processing message at the top of the datatables instead of in the middle, you can achieve this by using

div.dataTables_wrapper div.dataTables_processing
and applying top: 0 (or top:-10 if you prefer to see the headers while the table is loading):

div.dataTables_wrapper div.dataTables_processing {
  top: 0;
}

You can view the code on JSFiddle here: https://jsfiddle.net/0usjep4r/

(Credit for the DataTables ajax request goes to gyrocode. I made modifications to achieve the desired outcome.)

Answer №2

The issue arising from solely including top: 0 is the potential obstruction of the 'Show [num] entries' tool:

In a live application, it's generally agreed upon that concealing tools that may be utilized by users later on leads to poor user experience. If you share this view, implementing a few additional modifications can rectify this problem:

#get-storage-space-dt-listing-table_processing {
  top: -10px;
  width: auto;
  margin: 0;
  transform: translateX(-50%);
}

By doing so, the 'Show [num] entries' feature becomes visible once more:

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Text located incorrectly beside image within container box

Below is the HTML code that defines a box containing title text and an image. <div id="about"> <div id="title"> <h3><b>About</b></h3></div> <div id="text"><p>Text</p></div> <div id="img ...

Emphasizing particular text within a webpage element

Is there a way to add color to an HTML element, but only on a specific part of the content? Currently, I assign a class called "matchedOn" to each matching portion and use the following jQuery code to apply the necessary coloring: $('.matchedOn:cont ...

Guide: How to transfer the output from MongoDB in Node.js to AngularJS?

Currently, I am using Node.js to query my data from a MongoDB database. However, I am facing an issue where the data is not being sent out as expected when running this particular function. var findIco = function(db, callback) { var cursor = db.collec ...

Receiving encoded characters in the response

URL: I have encountered an issue where I am trying to retrieve the PDF file from the URL above using code. In tools like Postman or Insomnia, I am able to see the output as expected in PDF format. However, when I attempt it with code, I am receiving rando ...

Angular service provided by MetronicApp

I've been working on integrating Angular services with the Metronic App. This is how I defined my service: angular.module('MetronicApp').service('shaperService', ['$http', function ($http) { this.shapers = function(param ...

Attempting to utilize a Jquery Ajax post method to retrieve information from my specified URL and display it within my HTML Div element

Seeking assistance in fetching real-time data using a jQuery Ajax Post method. My experience lies mainly in SQL and C#, so coding in this language is relatively new to me. I was advised to use this script, which seemed straightforward. However, despite my ...

Employing the GET method to retrieve the values of two text inputs

I'm struggling to retrieve the values from two text input fields: <form action="search.php"> <input type="text" name="q1"> <input type="text" name="q2" > <input type="submit" name="submit" value="Search" /> </form> On t ...

Encountering an issue when attempting to save JSON data in the database: unable to convert object into a string

To summarize, my data is stored in Javascript: JSONdata = { name: form.name.value, address1: form.custa.value, address2: form.custa2.value, postcode: form.custpc.value, order: fullorder, cost: document.getElementById('total&ap ...

I'm stuck trying to figure out all the parameters for the MapsPage component in Angular 2

Currently, I am utilizing Angular2 with Ionic2 for my mobile app development. Everything was working flawlessly until I decided to incorporate a new module for Google Maps navigation. Specifically, I am using phonegap-launch-navigator for this purpose. The ...

In Laravel, Inertia.js will automatically close a modal if there are no validation errors present

Here is the method I am currently using: methods: { submit() { this.$inertia.post('/projects', this.form); this.openModal = false; }, }, Unfortunately, this method closes the modal even if there are validation erro ...

Having trouble converting the file to binary format in order to send it to the wit.ai api through node.js

I am having trouble converting an Audio file to Binary format for sending it to the Wit.AI API. The node.js platform is being used for this purpose. On the front-end, user voice is recorded using the Mic-recorder Module. Any guidance or suggestions would b ...

Checking the response from an AJAX call with an if/else statement

Is there a way to create a counter for unread messages using PHP and jQuery? Below is the PHP code in BubbleStat.php: $totalMsg = $mysql->totalRows("SELECT msg_id from messages WHERE msg_opened = 0 AND msg_receiver = '".$_SESSION["ActiveUserSessio ...

The ng-app feature is causing the script to run endlessly

Currently, I am troubleshooting an issue within my angular application that is built on the asp.net web application empty template. The problem arises when I utilize ng-app; if I leave it blank, the $routeProvider fails to initialize. However, if I specify ...

Having trouble with Laravel 5.8 Bootstrap integration within JQuery?

i found a helpful resource at everything seems to be working well in the view, but i'm encountering issues when trying to implement it in JQuery. if anyone has suggestions on how to resolve this problem, please let me know. here is the PHP code for ...

Guide on how to showcase boxes or images as they are loaded using the jQuery media boxes library

I recently incorporated the Jquery mediabox () to showcase my image gallery. While it works well for a small number of images, it seems to wait until all images have loaded before displaying them when dealing with thousands of pictures. This delay can be ...

Is there a way to export a specific portion of a destructuring assignment?

const { a, ...rest } = { a: 1, b: 2, c: 3 }; If I want to export only the rest object in TypeScript, how can I achieve that? ...

Using ASP.net MVC 4 to Implement Validation with Bootstrap Modal and PartialView

After switching from a simple View with validation to using a bootstrap modal and PartialView in my application, I encountered some issues. The client-side validation no longer works and the server-side validation redirects me to a new page instead of disp ...

Uploading video files using XMLHttpRequest encountered an error on a particular Android device

One of our testers encountered an issue where they failed to upload a video file (.mp4) on a specific Android mobile phone. Interestingly, the same file uploaded successfully on an iPhone and another Android device. To investigate further, I attempted to ...

Utilize PHP to transform JSON data into JavaScript

Hello, I am a newcomer to Stackoverflow and I need some assistance. My issue involves converting JSON with PHP to JavaScript. I am using PHP to fetch data from a database and create JSON, which I then want to convert for use in JavaScript as an object (obj ...

Tips for incorporating inline styling into the body element

Can someone help me with adding inline style to the body element using jQuery? I want to set the background color to white (#FFFFFF). Your assistance would be highly appreciated. Thank you! ...