56720

Controlling order of XPages CSS using mobile theme

Question:

When using the XPages Mobile theme the CSS files I add to the page as resources are added before the CSS files provided by IBM as part of the mobile theme.

Example:

<xp:this.resources> <xp:styleSheet href="css/font-awesome/css/font-awesome.css"></xp:styleSheet> <xp:styleSheet href="/mobile.css"></xp:styleSheet> </xp:this.resources>

Generate the following HTML

<link rel="stylesheet" type="text/css" href="/redpill/graph.nsf/css/font-awesome/css/font-awesome.css"> <link rel="stylesheet" type="text/css" href="/redpill/graph.nsf/mobile.css"> <link rel="stylesheet" type="text/css" href="/xsp/.ibmxspres/dojoroot-1.8.1/dojox/mobile/themes/iphone/iphone.css"> <link rel="stylesheet" type="text/css" href="/xsp/.ibmxspres/.extlib/css/customMobile.css"> <link rel="stylesheet" type="text/css" href="/xsp/.ibmxspres/.extlib/css/customIphone.css">

Is there a way to force my own custom controls to be added after IBM's? It is more challenging (but not impossible) to control the style when my own CSS is listed first in the chain.

Answer1:

This answer assumes that using the mobile tools doesn't change the way objects are loaded.

I use a theme, and my CSS files appear after the generated CSS files.

<theme extends="webstandard"> <resource> <content-type>text/css</content-type> <href>crmStyle.css</href> </resource> </theme>

Generates the following on pages using the theme:

<link rel="stylesheet" type="text/css" href="/xsp/.ibmxspres/dojoroot-1.8.1/dijit/themes/tundra/tundra.css"> <link rel="stylesheet" type="text/css" href="/xsp/.ibmxspres/dojoroot-1.8.1/ibm/domino/widget/layout/css/domino-default.css"> <link rel="stylesheet" type="text/css" href="/domjava/xsp/theme/webstandard/xsp.css"> <link rel="stylesheet" type="text/css" href="/domjava/xsp/theme/webstandard/xspLTR.css"> <link rel="stylesheet" type="text/css" href="/domjava/xsp/theme/webstandard/xspSF.css"> <link rel="stylesheet" type="text/css" href="/Path/crmStyle.css">

To test CSS files with mobile theme, I did the following:

<img alt="Select Mobile Theme" class="b-lazy" data-src="https://i.stack.imgur.com/X5XJh.png" data-original="https://i.stack.imgur.com/X5XJh.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" />

Created new page m_Landing. Added CSS File as Resource.

<?xml version="1.0" encoding="UTF-8"?> <xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xe="http://www.ibm.com/xsp/coreex" xmlns:xc="http://www.ibm.com/xsp/custom" themeId="MyTheme"> <xp:this.resources> <xp:styleSheet href="/crmStyle.css"></xp:styleSheet> </xp:this.resources> </xp:view>

Generated HTML:

<head> <title></title> <script type="text/javascript" src="/xsp/.ibmxspres/dojoroot-1.8.1/dojo/dojo.js" djConfig="locale: 'en-us'"></script> <script type="text/javascript" src="/xsp/.ibmxspres/dojoroot-1.8.1/ibm/xsp/widget/layout/layers/xspClientDojo.js"></script> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> <meta name="apple-mobile-web-app-capable" content="yes"> <link rel="stylesheet" type="text/css" href="/Path/crmStyle.css"> </head>

Answer2:

I found a solution. I am not sure it complies with the W3 spec but I can simply add the link in the Body by placing it as XML code inside the XPage.

<link rel="stylesheet" type="text/css" href="/redpill/graph.nsf/mobile.css"></link>

Recommend

  • Using textscan in Matlab on .csv files
  • Airflow External sensor gets stuck at poking
  • C# complex type initializer compiles without new keyword
  • Is there a way to automatically generate equals and hashcode method in Visual Studio
  • SQLite vs LocalStorage
  • Navbar active tab change color when scrolled
  • How to use request.getParameterValues?
  • uploading images in codeigniter, is userfile required?
  • How to integrate Struts2 with Thymeleaf?
  • How to call an action method using OGNL
  • Macbook React Native install
  • Upload document to specific folder in a SharePoint Document library using WebClient
  • Textarea v-model initial value with VueJS and Laravel
  • On Woocommerce order complete, activate woosensei course
  • Dynamically create controls in android using Kotlin
  • VB silverlight for windows phone “Handles clause requires a WithEvents variable defined in the conta
  • Downgrade NG2 Directive to AngularJS
  • NextJS auth with an external server
  • Encounter error “IB API required” when IB API is installed
  • hadoop jar command points to local filesystem
  • Retrieve 3rd MAX salary in Hive
  • Accessing parent namespace inside a Shiny Module
  • Core Data and Reflexive Entity relationships (to-one or to-many)
  • Network communication options in Java (Client/Server)
  • mssql script data insert or update
  • Adding Dynamic Row and Data on Checkbox Click
  • Find corners of a rotated rectangle
  • MayAVI install on Python 3.6 [duplicate]
  • Create .java file and compile it to a .class file at runtime
  • Implementation of timeout in LDAP
  • Find all parks for a given zipcode with google maps
  • Magento-Change Attribute of All Products
  • how to specify different css for ie
  • Silverlight Event Log in Isolated Storage
  • time column in sqlite using gorm
  • Runtime complexity of getting the length of a string in different representations
  • Rotating Towards Path in OpenGL
  • How to warp text around image in iOS?