如何在SAPUI5的ODataModel中使用绝对路径?

时间:2016-02-23 12:24:46

标签: data-binding odata sapui5

我想在SAPUI5应用程序中使用绝对路径,以便直接访问单个资源。

根据http://help.sap.com/saphelp_nw75/helpdata/de/6c/47b2b39db9404582994070ec3d57a2/content.htm它应该有用。

但是当我使用类似的东西时:

<Text text="{users>/Users('123')/LastName}" />

无法获取数据。

有谁知道这里有什么问题?

1 个答案:

答案 0 :(得分:2)

使用属性的参数化路径时,似乎不会自动加载该值。

要访问参数定义的对象,可以在控件上为该对象指定element binding,然后以相对方式引用该属性:

    my edit.php code 
    <!DOCTYPE html>
    <html dir="ltr" lang="en-US"><head><!-- Created by Artisteer v4.0.0.58475 -->
        <meta charset="utf-8">
        <title>library</title>
        <meta name="viewport" content="initial-scale = 1.0, maximum-scale = 1.0, user-scalable = no, width = device-width">
        <link href='https://sites.google.com/site/99webdemos/favicon.png' rel='shortcut icon' type='image/x-icon'/>
        <!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
        <link rel="stylesheet" href="css/style.css" media="screen">
        <!--[if lte IE 7]><link rel="stylesheet" href="style.ie7.css" media="screen" /><![endif]-->
        <link rel="stylesheet" href="css/style.responsive.css" media="all">


        <script src="js/jquery.js"></script>
        <script src="js/script.js"></script>
        <script src="js/script.responsive.js"></script>
        <script type="text/javascript" language="JavaScript">
        jQuery(document).ready(function()
        {
          jQuery(".form-message").fadeOut(10000);
        });
        </script>
       

    <style>.art-content .art-postcontent-0 .layout-item-0 { padding-right: 10px;padding-left: 10px;  }
    .ie7 .post .layout-cell {border:none !important; padding:0 !important; }
    .ie6 .post .layout-cell {border:none !important; padding:0 !important; }

    </style></head>
    <body>
    <div id="art-main">
        <div id="art-header-bg" class="clearfix">
                </div>
        <div id="art-hmenu-bg" class="art-bar art-nav clearfix">
        </div>
        <div class="art-sheet clearfix">
    <header class="art-header clearfix">


        <div class="art-shapes">
    <h1 class="art-headline" data-left="0.5%">
        <a  href="http://www.99demos.blogspot.com" target="_blank">library</a>
    </h1>
    <h2 class="art-slogan" data-left="87.05%"><a href="http://99demos.blogspot.in/2014/06/createreadupdate-delete-with-image.html"></a></h2>


                </div>

    <nav class="art-nav clearfix">
        <div class="art-nav-inner">
        <ul class="art-hmenu"><li><a href="index.php" class="active">Home</a></li></ul> 
            </div>
        </nav>

                        
    </header>
    <div class="art-layout-wrapper clearfix">
                    <div class="art-content-layout">
                        <div class="art-content-layout-row">
                            <div class="art-layout-cell art-content clearfix"><article class="art-post art-article">
                                    <h2 class="art-postheader">customer form</h2>
                                                    
                    <div class="art-postcontent art-postcontent-0 clearfix"><div class="art-content-layout">
        <div class="art-content-layout-row">
        <div class="art-layout-cell layout-item-0" style="width: 100%" >
            <br>
            
            
    <?php
    ob_start(); 
    include('include/connect.php'); 
    if(isset($_GET['id']))
    {

    	$qry = "SELECT * FROM tbl_emp where id=".$_GET['id'];
        $result = mysql_query($qry);
    	$row = mysql_fetch_array($result);
    	
        if($_SERVER["REQUEST_METHOD"] == "POST")
        {
            $name = $_POST["name"];
             $age = $_POST["age"];`enter code here`
             $gender = $_POST["gender"];
             $martial = $_POST["martial"];
             $contact = $_POST["contact"];
             $email = $_POST["email"];
              $location= $_POST["location"];
                              $category= $_POST["category"];
                  
            IF($_FILES['file']['name']!='')
            {
    				 $file='uploads/'.$row['image'];
    				 @unlink($file);
               	     $tmp_name = $_FILES["file"]["tmp_name"];
                	 $namefile = $_FILES["file"]["name"];
    				 $ext = end(explode(".", $namefile));
    				 $image_name=time().".".$ext;
                	 $fileUpload = move_uploaded_file($tmp_name,"uploads/".$image_name);
    		}
    		else
    		{
    				$image_name=$row['image'];
    		}
    		
     	 	 $sqlAdd ="update tbl_emp set name='".$name."', age='".$age."', gender='".$gender."', martial='".$martial."', contact='".$contact."', email='".$email."', location='".$location."', category='".$category."', image='".$image_name."'  where id=".$_GET['id'];
    	  	 mysql_query($sqlAdd);
             header("Location:add.php?id=".@$_GET['id']."&msg=success");
    		 exit;
        }		
    }
    else
    {
        if($_SERVER["REQUEST_METHOD"] == "POST")
        {
            $name = $_POST["name"];
           $age = $_POST["age"];
           $gender = $_POST["gender"];
            $martial = $_POST["martial"];
            $contact = $_POST["contact"];
             $email = $_POST["email"];
              $location= $_POST["location"];
                             $category= $_POST["category"];
                   
            IF($_FILES['file']['name']!='')
            {
                $tmp_name = $_FILES["file"]["tmp_name"];
                $namefile = $_FILES["file"]["name"];
    			$ext = end(explode(".", $namefile));
    			$image_name=time().".".$ext;

                $fileUpload = move_uploaded_file($tmp_name,"uploads/".$image_name);
            }
            $sqlAdd = mysql_query("insert into tbl_emp(name,age,gender,martial,contact,email,location,category,image) VALUES('$name','$age','$gender','$martial','$contact','$email','$location','$category','$image_name')");
            header("Location:index.php?msg=success");
    		exit;
        }
    }
        ob_end_flush();
    	
    	if(isset($_GET['msg']))
    	{
    	?>
        <div style="color:red;padding-bottom:10px;" class="form-message" align="center"><b>Task completd successfully.</b></div>
        <?php	
    	}
    ?>


    <form  method="post" name="login" id="login" enctype="multipart/form-data">
     <table class="table" width="100%">
        <tr>
        <td width="10%">Customer Details</td>
        <td></td>
      </tr>
        <tr>
        <td width="10%">Full Name</td>
        <td><input name="name" type="text" placeholder="Firstname Lastname" pattern="[A-Za-z-0-9]+\s[A-Za-z-'0-9]+" required value="<?php echo @$row['name'];?>"></td>
      </tr>
     <tr>
        <td width="20%">Age</td>
        <td><input name="age" type="text" value="<?php echo @$row['2'];?>" ></td>
      </tr>
       <tr>
       <td>Gender</td>
     <td><input type="radio" name="gender" value="male" <?php if($result['gender']=="male"){ echo "checked";}?> >
     Male
     <input type="radio" name="gender" value="female" <?php if($result['gender']=="female"){ echo "checked";}?>>
     Female</td>
     </tr>
      <tr>
        <td width="10%">Martial Status</td>
        <td><input name="martial" type="text" value="<?php echo @$row['4'];?>" ></td>
      </tr>
      <tr>
        <td width="20%">Contact Number</td>
        <td><input name="contact" type="text" value="<?php echo @$row['5'];?>"></td>
      </tr>
       <tr>
        <td width="10%">Email Address</td>
        <td><input name="email" type="text" value="<?php echo @$row['6'];?>"></td>
      </tr>
      <tr>
        <td width="10%">Location</td>
        <td><input name="location" type="text" value="<?php echo @$row['7'];?>" ></td>
      </tr>
      
       <tr>
        <td width="10%">category</td>
        <td>
       <select name="category" id="category" value="<?php echo @$row['11'];?>">
        <option <?php if ($selected == 'select' ) echo 'selected'; ?> value="select">select</option>
        <option <?php if ($selected == '1' ) echo 'selected'; ?> value="1">1</option>
        <option <?php if ($selected == '2' ) echo 'selected'; ?> value="2">2</option>
        <option <?php if ($selected == '3' ) echo 'selected'; ?> value="3">3</option>
      </select>
        </td>
      </tr>
     
      <tr>
        <td width="10%"> Image</td>
        <td><input name="file" type="file" multiple="" ></td>
        
      </tr>
       <?php
       if(isset($row['image'])) 
       {
       ?>
       <tr>
            <td>&nbsp;</td>
            <td><img src="uploads/<?php echo $row['image'];?> " height="50" width="50"></td>
       </tr>
    	<?php
    	}
    	?>
      <tr>
        <td>&nbsp;</td>
        <td>
        <input name="submit" value="Submit" type="submit" class="submit">
        <input name="submit" value="Cancel" type="button" class="submit" onClick="window.location='index.php'">
        </td>
      </tr>
    </table>
    </form> 
    <a href="http://dme-medical.com/library/search.php">Go back to list</a>       
        </div>
        </div>
    </div>
    </div>
    </article></div>
                        </div>
                    </div>
                </div>
        </div>
    <footer class="art-footer clearfix">
      <div class="art-footer-inner">
    <p>Copyright © 2016. All Rights Reserved.</p>
        <p class="art-page-footer">
          
        </p>
      </div>
    </footer>

    </div>


    </body></html>