Build Mobile App Using OpenUI5 and Cordova

Vrundesha Joshi
Updated on 18-Dec-2019 08:26:42

324 Views

You are thinking correctly for your requirement. What you can do is, use the read method for each entityset to read the oData. In the success callback for this method, you can parse the result objects into a corresponding JSON model.Now, you can have working logic as per which:When you online, uses the additional layer to fill the JSON model from the oData that has been readWhen offline, you can read from local storage.

Use jQuery Attribute Selector with a Period

Amit D
Updated on 18-Dec-2019 08:25:45

319 Views

jQuery Attribute selector is used to select elements with the specified attribute and value. You can easily use it with a period (.) or a hash (#).ExampleYou can try to run the following code to learn how to use jQuery selector with a period:Live Demo $(document).ready(function(){    $( "div[myattr*='.']" ).css("background-color", "yellow");   }); Java HTML Ruby

Remove Disabled Attribute Using jQuery

Amit D
Updated on 18-Dec-2019 08:24:47

13K+ Views

To remove disabled attribute using jQuery, use the removeAttr() method. You need to first remove the property using the prop() method. It will set the underlying Boolean value to false.ExampleYou can try to run the following code to learn how to remove disabled attribute using jQuery:Live Demo $(document).ready(function(){     $('.disabledCheckboxes').prop("disabled", true);     $('.disabledCheckboxes').removeAttr("disabled");     $(document).ready(function(){         $('button').on('click', function() {           if (this.hasAttribute("disabled")) {              alert('The disabled attribute exists')           } else {              alert('The disabled attribute does not exist')           }         })     });  });    Result

Set Checked for a Checkbox with jQuery

Amit D
Updated on 18-Dec-2019 08:22:59

2K+ Views

Use the checked attribute to set the checkbox with jQuery. Also, the prop() method is used to get the property value.ExampleYou can try to run the following code to learn how to set checked for a checkbox:Live Demo   jQuery Example     b {      color: green;   }       Check/ Uncheck this checkbox   $( "input" ).change(function() {   var $input = $( this );   $( "p" ).html(     ".attr( \"checked\" ): " + $input.attr( "checked" ) + "" +     ".prop( \"checked\" ): " + $input.prop( "checked" ) + "" +     ".is( \":checked\" ): " + $input.is( ":checked" ) + "" ); }).change();  

Use Hash in jQuery Attribute Selector

Amit D
Updated on 18-Dec-2019 08:21:18

368 Views

To use # in jQuery attribute selector, include # under *= . This will find the attribute with #.ExampleYou can try to run the following code to learn how to use # in jQuery attribute selector:Live Demo     $(document).ready(function()  {        $( "div[myattr*='#']" ).css("background-color", "yellow");     }); Java HTML Ruby

Get HTML Attribute Value Using jQuery

Amit D
Updated on 18-Dec-2019 08:20:27

306 Views

To get the value of html attribute, use the val() method.ExampleYou can try to run the following code to learn how to use jQuery to get the value of HTML attribute of elements:Live Demo                          $(document).ready(function() {             $("#buttonSet").click(function () {                           $("#buttonGet").removeAttr('disabled');             });             $("#buttonGet").click(function () {               $("#result").html(               $("#txtBox").val() + "" +               $("input:radio[name=rd]:checked").val()             );          });          });                     Name                   Gender       Male       Female                            

Add Attribute to Specific HTML Tags in jQuery

Amit D
Updated on 18-Dec-2019 08:19:15

1K+ Views

Use the attr() method to add an attribute into specific HTML tags in jQuery.ExampleYou can try to run the following code to learn how to add an attribute into specific HTML tags:Live Demo   $(document).ready(function(){       $(document).ready(function(){          $("button.button1").attr("myid", "myvalue");            $('button').on('click', function() {                     if (this.hasAttribute("myid")) {                alert('True: The new attribute added successfully.')             } else {                alert('False')             }           })       });   });           Button 1    

Use jQuery Selectors on Custom Data Attributes with HTML5

Amit D
Updated on 18-Dec-2019 08:16:25

411 Views

To use jQuery selectors on custom data attributes, you can use contains, starts with, and ends with for the HTML data attributes.ExampleOther than that, you can try to run the following code to learn how to use jQuery selectors on custom data attributes using HTML5:Live Demo $(document).ready(function(){   //stored selector   var group = $('ol[data-group="Subjects"]');   // starts with M   var maths = $('[data-subject^="M"]',group).css('color','green');   // contains the string graph   var graph = $('[data-subject*="graph"]',group).css('color','blue'); });   Maths   Science   Geography   History

jQuery Selector for Elements with ID Ending with a Given String

Amit D
Updated on 18-Dec-2019 08:15:42

2K+ Views

To get the elements with an ID that ends with a given string, use attribute selector with $ character.ExampleYou can try to run the following code to learn how to to use jQuery selector for the elements with an ID that ends with a given string. Let’s say we are going for elements with an ID ending with the string “new1”.Live Demo $(document).ready(function(){   $("[id$=new]").css("background-color", "yellow");     }); Java HTML Ruby

Using Subset of Items Present in the List in SAP Program

Smita Kapse
Updated on 18-Dec-2019 08:02:27

169 Views

You can use a SWITCH CASE statement to handle your scenario. This is a good choice if you know well in advance what all properties are required and what is not required. Also, it will let you to unit test your code.Otherwise, you can go for a collection like a dictionary.You can think of using HashSet or hashtable as well, it entirely depends upon the usage of the list created.

Advertisements