|
Publicité ' | |||||||||||||||||||||||
|
|
#1 |
|
Membre éprouvé
![]() ![]() |
Bonjour,
J'avais un problème de navigation avec le Pager de listes et en scrutant les sources xsl du framework, je me suis rendu compte d'une contrainte assez pénalisante. Le pager actuel d'XMLRAD utilise un champ caché de formulaire (xxx_STARTINGROW) pour indiquer au framework à partir de quel enregistrement il doit "fetcher" le SGBD. Le problème est que le nom du dit formulaire est imposé : Il s'agit de 'MainForm'. Ca m'arrange pas du tout car j'utilise un autre nom de formulaire (sachant qu'il y a plusieurs formulaires dans ma page : Insertxxx, Updatexxx, Deletexxx etc et que je ne souhaite pas changer le nom de ces formulaires). Alors j'ai cherché dans les sources un paramètre de <xsl:template name="xslc:NavigationPad"> dans lequel j'aurais pu indiquer le nom du formulaire prenant en charge le Paging. Peine perdue puisque 'MainForm' est imposé en dur par le framework : Code :
<xsl:attribute name="onclick"><![CDATA[SetField('MainForm', ']]><xsl:value-of select="@RecordName"/><![CDATA[_StartingRow', ']]><xsl:value-of select="$DoubleStepBack"/><![CDATA['); ]]><xsl:value-of select="$OnClick"/><![CDATA[return false;]]></xsl:attribute> Sylvain
__________________
.NET / ASP.NET MVC / Delphi / XMLRAD / XSL / Technos Web Mon Blog : http://blog.developpez.com/index.php?blog=89 Mes Articles : http://sjames.developpez.com/ Rubrique XMLRAD: http://xmlrad.developpez.com |
|
|
00
|
|
|
#2 |
|
Membre éprouvé
![]() ![]() |
Je propose un add-on à xslc.xsl pour résoudre le problème, afin de pouvoir appeler le Pager ainsi :
<xsl:call-template name="xslc:ListFooter"> <xsl:with-param name="colspan">9</xsl:with-param> <xsl:with-param name="Form">FormInsertPARTICIPATION</xsl:with-param> <xsl:with-param name="OnClick">document.FormInsertPARTICIPATION.submit();</xsl:with-param> </xsl:call-template> Le correctif (en gras) : <xsl:template name="xslc:NavigationPad"> <xsl:param name="Form"/> <xsl:param name="CommonURL"> <xsl:value-of select="/document/XMLC_Params/XMLC_ScriptName"/>/<xsl:value-of select="/document/XMLC_Params/XMLC_Action"/>?<xsl:if test="/document/XMLC_Params/XMLC_NavigationParams!=''"> <xsl:value-of select="/document/XMLC_Params/XMLC_NavigationParams"/>&</xsl:if> <xsl:value-of select="@RecordName"/>_StartingRow=</xsl:param> <xsl:param name="URLParams"/> <xsl:param name="OnClick"/> <xsl:param name="DisplayPreviousArrows">1</xsl:param> <xsl:param name="DisplayNextArrows">1</xsl:param> <xsl:param name="StartingRow" select="@StartingRow"/> <xsl:param name="EOF" select="@EOF"/> <table border="0" cellpadding="0" cellspacing="0"> <tr> <xsl:if test="$DisplayPreviousArrows = '1' and $StartingRow != '0'"> <xsl:variable name="DoubleStepBack"> <xsl:choose> <xsl:when test="(@StartingRow)-(2*@MaxRows)+2>0"> <xsl:value-of select="(@StartingRow)-(2*@MaxRows)+2"/> </xsl:when> <xsl:otherwise>0</xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:variable name="StepBack"> <xsl:choose> <xsl:when test="(@StartingRow)-(@MaxRows)+1>0"> <xsl:value-of select="(@StartingRow)-(@MaxRows)+1"/> </xsl:when> <xsl:otherwise>0</xsl:otherwise> </xsl:choose> </xsl:variable> <td style="border: 0px; padding-right: 5px;"> <a> <xsl:choose> <xsl:when test="$OnClick != ''"> <xsl:attribute name="href">.</xsl:attribute> <xsl:attribute name="onclick"><![CDATA[SetField(']]><xsl:value-of select="$Form"/><![CDATA[', ']]><xsl:value-of select="@RecordName"/><![CDATA[_StartingRow', ']]><xsl:value-of select="$DoubleStepBack"/><![CDATA['); ]]><xsl:value-of select="$OnClick"/><![CDATA[return false;]]></xsl:attribute> </xsl:when> <xsl:otherwise> <xsl:attribute name="href"><xsl:value-of select="$CommonURL"/><xsl:value-of select="$DoubleStepBack"/><xsl:value-of select="$URLParams"/></xsl:attribute> </xsl:otherwise> </xsl:choose> <img alt="{/document/Locales/DoublePrevious}" border="0" src="{$XMLC_PictosPath}ico_stepdouble_left.gif"/> </a> </td> <td style="border: 0px; padding-right: 5px;"> <a> <xsl:choose> <xsl:when test="$OnClick != ''"> <xsl:attribute name="href">.</xsl:attribute> <xsl:attribute name="onclick"><![CDATA[SetField(']]><xsl:value-of select="$Form"/><![CDATA[', ']]><xsl:value-of select="@RecordName"/><![CDATA[_StartingRow', ']]><xsl:value-of select="$StepBack"/><![CDATA['); ]]><xsl:value-of select="$OnClick"/><![CDATA[return false;]]></xsl:attribute> </xsl:when> <xsl:otherwise> <xsl:attribute name="href"><xsl:value-of select="$CommonURL"/><xsl:value-of select="$StepBack"/><xsl:value-of select="$URLParams"/></xsl:attribute> </xsl:otherwise> </xsl:choose> <img alt="{/document/Locales/Previous}" border="0" src="{$XMLC_PictosPath}ico_step_left.gif"/> </a> </td> </xsl:if> <xsl:if test="$DisplayNextArrows = '1' and $EOF != '1'"> <xsl:variable name="DoubleStepForward"> <xsl:value-of select="(@LastRow)+(@MaxRows)-1"/> </xsl:variable> <td style="border: 0px; padding-right: 5px;"> <a> <xsl:choose> <xsl:when test="$OnClick != ''"> <xsl:attribute name="href">.</xsl:attribute> <xsl:attribute name="onclick"><![CDATA[SetField(']]><xsl:value-of select="$Form"/><![CDATA[', ']]><xsl:value-of select="@RecordName"/><![CDATA[_StartingRow', ']]><xsl:value-of select="@LastRow"/><![CDATA['); ]]><xsl:value-of select="$OnClick"/><![CDATA[return false;]]></xsl:attribute> </xsl:when> <xsl:otherwise> <xsl:attribute name="href"><xsl:value-of select="$CommonURL"/><xsl:value-of select="@LastRow"/><xsl:value-of select="$URLParams"/></xsl:attribute> </xsl:otherwise> </xsl:choose> <img alt="{/document/Locales/More}" border="0" src="{$XMLC_PictosPath}ico_step_right.gif"/> </a> </td> <td style="border: 0px; padding-right: 5px;"> <a> <xsl:choose> <xsl:when test="$OnClick != ''"> <xsl:attribute name="href">.</xsl:attribute> <xsl:attribute name="onclick"><![CDATA[SetField(']]><xsl:value-of select="$Form"/><![CDATA[', ']]><xsl:value-of select="@RecordName"/><![CDATA[_StartingRow', ']]><xsl:value-of select="$DoubleStepForward"/><![CDATA['); ]]><xsl:value-of select="$OnClick"/><![CDATA[return false;]]></xsl:attribute> </xsl:when> <xsl:otherwise> <xsl:attribute name="href"><xsl:value-of select="$CommonURL"/><xsl:value-of select="$DoubleStepForward"/><xsl:value-of select="$URLParams"/></xsl:attribute> </xsl:otherwise> </xsl:choose> <img alt="{/document/Locales/DoubleMore}" border="0" src="{$XMLC_PictosPath}ico_stepdouble_right.gif"/> </a> </td> </xsl:if> </tr> </table> </xsl:template> <xsl:template name="xslc:IndexNavigation"> <xsl:param name="Form"/> <xsl:param name="CommonURL"> <xsl:value-of select="/document/XMLC_Params/XMLC_ScriptName"/>/<xsl:value-of select="/document/XMLC_Params/XMLC_Action"/>?<xsl:if test="/document/XMLC_Params/XMLC_NavigationParams!=''"> <xsl:value-of select="/document/XMLC_Params/XMLC_NavigationParams"/>&</xsl:if> <xsl:value-of select="@RecordName"/>_StartingRow=</xsl:param> <xsl:param name="URLParams"/> <xsl:param name="OnClick"/> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td class="clOverBackground" style="border: 0px; padding-right: 5px;"> <xsl:call-template name="xslc:IndexNavigationNo"> <xsl:with-param name="Form" select="$Form"/> <xsl:with-param name="CommonURL" select="$CommonURL"/> <xsl:with-param name="URLParams" select="$URLParams"/> <xsl:with-param name="OnClick" select="$OnClick"/> <xsl:with-param name="IndexNo">1</xsl:with-param> </xsl:call-template> <xsl:call-template name="xslc:IndexNavigationNo"> <xsl:with-param name="Form" select="$Form"/> <xsl:with-param name="CommonURL" select="$CommonURL"/> <xsl:with-param name="URLParams" select="$URLParams"/> <xsl:with-param name="OnClick" select="$OnClick"/> <xsl:with-param name="IndexNo">2</xsl:with-param> </xsl:call-template> <xsl:call-template name="xslc:IndexNavigationNo"> <xsl:with-param name="Form" select="$Form"/> <xsl:with-param name="CommonURL" select="$CommonURL"/> <xsl:with-param name="URLParams" select="$URLParams"/> <xsl:with-param name="OnClick" select="$OnClick"/> <xsl:with-param name="IndexNo">3</xsl:with-param> </xsl:call-template> <xsl:call-template name="xslc:IndexNavigationNo"> <xsl:with-param name="Form" select="$Form"/> <xsl:with-param name="CommonURL" select="$CommonURL"/> <xsl:with-param name="URLParams" select="$URLParams"/> <xsl:with-param name="OnClick" select="$OnClick"/> <xsl:with-param name="IndexNo">4</xsl:with-param> </xsl:call-template> <xsl:call-template name="xslc:IndexNavigationNo"> <xsl:with-param name="Form" select="$Form"/> <xsl:with-param name="CommonURL" select="$CommonURL"/> <xsl:with-param name="URLParams" select="$URLParams"/> <xsl:with-param name="OnClick" select="$OnClick"/> <xsl:with-param name="IndexNo">5</xsl:with-param> </xsl:call-template> <xsl:call-template name="xslc:IndexNavigationNo"> <xsl:with-param name="Form" select="$Form"/> <xsl:with-param name="CommonURL" select="$CommonURL"/> <xsl:with-param name="URLParams" select="$URLParams"/> <xsl:with-param name="OnClick" select="$OnClick"/> <xsl:with-param name="IndexNo">6</xsl:with-param> </xsl:call-template> <xsl:call-template name="xslc:IndexNavigationNo"> <xsl:with-param name="Form" select="$Form"/> <xsl:with-param name="CommonURL" select="$CommonURL"/> <xsl:with-param name="URLParams" select="$URLParams"/> <xsl:with-param name="OnClick" select="$OnClick"/> <xsl:with-param name="IndexNo">7</xsl:with-param> </xsl:call-template> <xsl:call-template name="xslc:IndexNavigationNo"> <xsl:with-param name="Form" select="$Form"/> <xsl:with-param name="CommonURL" select="$CommonURL"/> <xsl:with-param name="URLParams" select="$URLParams"/> <xsl:with-param name="OnClick" select="$OnClick"/> <xsl:with-param name="IndexNo">8</xsl:with-param> </xsl:call-template> <xsl:call-template name="xslc:IndexNavigationNo"> <xsl:with-param name="Form" select="$Form"/> <xsl:with-param name="CommonURL" select="$CommonURL"/> <xsl:with-param name="URLParams" select="$URLParams"/> <xsl:with-param name="OnClick" select="$OnClick"/> <xsl:with-param name="IndexNo">9</xsl:with-param> </xsl:call-template> <xsl:call-template name="xslc:IndexNavigationNo"> <xsl:with-param name="Form" select="$Form"/> <xsl:with-param name="CommonURL" select="$CommonURL"/> <xsl:with-param name="URLParams" select="$URLParams"/> <xsl:with-param name="OnClick" select="$OnClick"/> <xsl:with-param name="IndexNo">10</xsl:with-param> </xsl:call-template> </td> </tr> </table> </xsl:template> <xsl:template name="xslc:IndexNavigationNo"> <xsl:param name="Form"/> <xsl:param name="CommonURL"/> <xsl:param name="URLParams"/> <xsl:param name="OnClick"/> <xsl:param name="IndexNo"/> <xsl:variable name="StartingRow_1" select="@MaxRows * $IndexNo - @MaxRows - (1*($IndexNo - 1))"/> <xsl:variable name="StartingRow"> <xsl:choose> <xsl:when test="$StartingRow_1 < 0">0</xsl:when> <xsl:otherwise> <xsl:value-of select="$StartingRow_1"/> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:choose> <xsl:when test="@StartingRow = $StartingRow"> <b> <xsl:value-of select="$IndexNo"/> </b> </xsl:when> <xsl:otherwise> <a> <xsl:choose> <xsl:when test="$OnClick != ''"> <xsl:attribute name="href">.</xsl:attribute> <xsl:attribute name="onclick"><![CDATA[SetField(']]><xsl:value-of select="$Form"/><![CDATA[', ']]><xsl:value-of select="@RecordName"/><![CDATA[_StartingRow', ']]><xsl:value-of select="$StartingRow"/><![CDATA['); ]]><xsl:value-of select="$OnClick"/><![CDATA[return false;]]></xsl:attribute> </xsl:when> <xsl:otherwise> <xsl:attribute name="href"><xsl:value-of select="$CommonURL"/><xsl:value-of select="$StartingRow"/><xsl:value-of select="$URLParams"/></xsl:attribute> </xsl:otherwise> </xsl:choose> <xsl:value-of select="$IndexNo"/> </a> </xsl:otherwise> </xsl:choose> </xsl:template>
__________________
.NET / ASP.NET MVC / Delphi / XMLRAD / XSL / Technos Web Mon Blog : http://blog.developpez.com/index.php?blog=89 Mes Articles : http://sjames.developpez.com/ Rubrique XMLRAD: http://xmlrad.developpez.com |
|
|
00
|
|
|
#3 |
|
Membre Expert
![]() |
interessant. mais j'en profiterais pour mettre le paramètre facultatif en mettant la valeur par défaut MainForm
__________________
RDM Tout Est Relatif Rubrique XMLRAD: http://xmlrad.developpez.com FAQ XMLRAD: http://xmlrad.developpez.com/faq/ |
|
|
00
|
|
|
#4 | |||
|
Membre éprouvé
![]() ![]() |
Citation:
Code :
__________________
.NET / ASP.NET MVC / Delphi / XMLRAD / XSL / Technos Web Mon Blog : http://blog.developpez.com/index.php?blog=89 Mes Articles : http://sjames.developpez.com/ Rubrique XMLRAD: http://xmlrad.developpez.com |
|||
|
|
00
|
|
|
#5 |
|
Membre éclairé
![]() |
Pas de problème pour l'ajout du paramètre dans xslc:NavigationPad, d'après l'équipe de dev. Ca sera donc dispo dans la future release.
Si ca t'embete pas, ils feront un copier/coller de ton code
__________________
Nicolas |
|
|
00
|
|
|
#6 | |
|
Membre éprouvé
![]() ![]() |
Citation:
Bien content car j'aurais pas besoin de mettre à jour les futures releases de la lib xsl. Thanks !
__________________
.NET / ASP.NET MVC / Delphi / XMLRAD / XSL / Technos Web Mon Blog : http://blog.developpez.com/index.php?blog=89 Mes Articles : http://sjames.developpez.com/ Rubrique XMLRAD: http://xmlrad.developpez.com |
|
|
|
00
|
Copyright © 2000-2012 - www.developpez.com