Integrate Xataface with dojo toolkit

Archived from the Xataface Users forum.

fantomasdm — Sat Jan 16, 2010 5:33 am

Is possible to integrate dojotoolkit in edit form? It’s a javascript toolkit open source url:http://www.dojotoolkit.org/


shannah — Mon Jan 25, 2010 11:15 am

What type of integration did you have in mind. Using blocks and slots it is quite easy to do one-off solutions if there is a widget that you want to use from a javascript toolkit.


fantomasdm — Mon Sep 13, 2010 3:50 am

Hi , I have integrate dojo, for usingi slider control… FYI. I think it’s very useful!!
I using a slider con integer fields for value from 0 to 10…

Code: Select all
`function block__valoreInt_widget()
    {
       
        $app =& Dataface_Application::getInstance();
      $record =& $app->getRecord(); // get the parent record
     
?>

             <div id="slider">
        </div>
        <p>
        <?php
            echo “<input type=’text’ id=’sliderValue’ dojoType=’dijit.form.TextBox’ value=’”.$record->val(‘valoreInt’). “’/>”;
            ?>
        </p>
     

        var slider = new dijit.form.HorizontalSlider({
            name: “valoreInt”,
            value: <?php   echo $record->val(‘valoreInt’); ?>,
            minimum: 0,
            maximum: 10,
            discreteValues:11,
            intermediateChanges: true,
            style: “width:300px;”,
            onChange: function(value) {
                dojo.byId(“sliderValue”).value = value;
            }
        },
        “slider”);
    });
</script>`


fantomasdm — Tue Sep 14, 2010 8:04 am

Hi I have add a code for using rangeSlider of dojo javascript toolkit, but first we have to patch dojo source using this documentation:http://bugs.dojotoolkit.org/ticket/11503

This is an example for rangesliter on 2 integer field with value between 0 and 10.
I hope that’s is useful!

P.S. I using document.body.className = ‘ claro ‘; for change style sheet of body..

Code: Select all
`function block__ValMin_widget()
{
   
         $app =& Dataface_Application::getInstance();
      $record =& $app->getRecord(); // get the parent record
      ?>
             
       <div id="rangeSlider" class=" nihilo ">
        </div>
      <?php
                 
echo “<input type=’text’ id=’ValMin’ dojoType=’dijit.form.TextBox’ value=’”.$record->val(‘ValMin’). “’/>”;
           
?>

            var rangeSlider = new dojox.form.HorizontalRangeSlider({
                name: “ValMin”,
                value: [ <?php   echo $record->val(‘ValMin’).”,”.$record->val(‘ValMax’) ; ?>],
                minimum: 0,
                maximum: 10,
                discreteValues:11,
                intermediateChanges: true,
                style: “width:300px;”,
                onChange: function(value) {
                    dojo.byId(“ValMin”).value = value[0];
                    dojo.byId(“ValMax”).value = value[1];
                }
            },
            “rangeSlider”);
        });
    </script>

<?php
}`