सहित एक साधारण कॉर्डोवा एंड्रॉइड उदाहरण मैं Cordova
का उपयोग कर एंड्रॉइड ऐप प्रोजेक्ट पर काम कर रहा था जिसमें मेरे पास Sqlite
डेटाबेस था।स्क्लाइट पढ़ने/लिखने और खोज
--------------------
ID | Name | Number |
--------------------
चूंकि मैं एंड्रॉइड ऐप्स में नया हूं, इसलिए मुझे यूआई तैयार हो गया। मेरे पास तालिका डेटा और 3 buttons
दिखाने के लिए दो text inputs
है, <div>
टैग है। और जब उपयोगकर्ता प्रत्येक कॉलम पर टैप करता है, तो पंक्ति सामग्री को हटाने या संपादित करने के लिए पॉपअप शो ऊपर होता है।
यहाँ यूआई के लिए HTML
कोड है:
<body>
<h1>My first App</h1>
<p>Open Database</p>
<div id="qrpopup" > //The hidden div tag for implementing the popup
<hr/>
<input type="text" id="editNameBox"><br>
<input type="text" id="editNumberBox"><br>
<button onclick="goDelete()">Delete</button>
<button onclick="goEdit()">Edit</button>
<button onclick="document.getElementById('qrpopup').style.display='none';">Discard</button>
</div>
<div>
Name<input type="text" value="Name" id="txtName">
Number<input type="text" value="123" id="txtNumber"><hr/>
</div>
<div id="tblDiv"></div>
<div style="text-align: center">
<button onclick="goInsert()">Insert</button>
<button onclick="goSearch()">Search</button>
<button onclick="successCB()">Show All</button>
</div>
</body>
इसके अलावा मैं कुछ Css
शैलियों का इस्तेमाल किया मेरे ऐप बेहतर लग रहा है बनाने के लिए। यहाँ मेरी style.css
फ़ाइल है:
input[type='text'] {
border: 1px solid black;
width: 200px;
margin-left: 10px;
}
table {
width:100%;
}
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th, td {
padding: 5px;
text-align: left;
}
table#t01 tr:nth-child(even) {
background-color: #eee;
}
table#t01 tr:nth-child(odd) {
background-color:#fff;
}
table#t01 th {
background-color: black;
color: white;
}
button {
margin: 10px;
font: bold 13px "Helvetica Neue", Helvetica, Arial, clean, sans-serif !important;
text-shadow: 0 -1px 1px rgba(0,0,0,0.25), -2px 0 1px rgba(0,0,0,0.25);
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
-moz-box-shadow: 0 1px 2px rgba(0,0,0,0.5);
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,0.5);
display: inline-block;
color: white;
padding: 5px 10px 5px;
white-space: nowrap;
text-decoration: none;
cursor: pointer;
background-color: #BE3E76;
border-style: none;
text-align: center;
overflow: visible;
}
button:active {
background-position: 0 -100px;
-moz-box-shadow: inset 0 1px 2px rgba(0,0,0,0.7);
-webkit-box-shadow: none;
}
#qrpopup {
position:fixed;z-index:9999;background-color:rgba(0, 0, 0,0.9);width:100%; height:100%;display:none;
}
लेकिन मुझे पता है कि कैसे मैं डालने बना, संपादित कर सकते हैं, हटा सकते हैं और खोज कार्यों Cordova
में javascript
का उपयोग कर?
इस के बजाय
sqlitePlugin.openDatabase
सवाल नहीं है। यदि आप इस कोड को स्टैक ओवरफ़्लो फिट करना चाहते हैं, तो एक प्रश्न पूछें और इसे उत्तर के रूप में उपयोग करें। –@ सीएल.आई ने अपने क्यू एंड ए को स्टैक नियमों के रूप में संपादित किया। –