我正在使用codeigniter.我有一个视图文件,我选择一个员工并使用表单操作发送id并选择员工可以执行的服务并将它们存储在一个表中.我已经插入了员工ID和服务ID.现在我需要插入员工姓名.
我的控制器文件是
class admin_service_limitation extends CI_Controller{
public function services()
{
$id = $this->session->userdata('employee');
$id_array = $this->input->post("services");
//I need to get the employee name here and store them in a table along with employee id and service id
for ($i = 0; $i < count($id_array); $i++) {
if(isset($id_array[$i])&& $id_array[$i]!=""){
$data_to_store = array('employee_id' => $id, 'service_id' => $id_array[$i]);
$this->add_service_model->save($data_to_store);
}
}
$data['addservice'] = $this->add_service_model->get_addservices();
$data['main_content'] = 'admin/service_limitation/newview';
$this->load->view('includes/template', $data);
}
Run Code Online (Sandbox Code Playgroud)
在这里我得到了员工ID和服务ID并将它们存储在一个table.That表包含像场employee_id,employee_name和service_id.
我的模型文件:
class sample_model extends CI_Model{ …Run Code Online (Sandbox Code Playgroud) 嗨,我正在动态创建表结构.当我单击一个包时,我将子行插入到表中,并添加了一个带有子值计数的rowspan值.现在我必须对我使用行的索引进行编号,但是当有行跨时它应该考虑整个行,如下所示1下一个数字必须是2.当我单击删除时我需要删除所有行跨越的子行.这是我实施的代码,
var rowspans;
var servicecount;
var cnt;
var ser = [];
var refForEmployee = new Firebase("https://kekranmekrandubai.firebaseio.com/package");
refForEmployee.on("value", function(snapshot) {
var data = snapshot.val();
var list = [];
for (var key in data) {
if (data.hasOwnProperty(key)) {
name = data[key].image ? data[key].image : '';
emp_name = data[key].package_name ? data[key].package_name : '';
service = data[key].service ? data[key].service : '';
servicecount = service.length;
console.log("service data");
console.log(service);
console.log(servicecount);
if (name.trim().length > 0) {
list.push({
image: name,
emp_name: emp_name,
services: service
})
}
}
} …Run Code Online (Sandbox Code Playgroud) 嗨,我正在使用codeigniter框架.我已经使用onkey change完成了自动填充操作.我使用ajax将id值发布到我的控制器函数,该函数将从服务表中获取单个数据行.现在我有超过1个记录ow行,它具有相同的id.例如,
+----+-----------------+------+
+ 1 + iPhone6 + 2 +
+----+-----------------+------+
+ 1 + ipod + 5 +
+----+-----------------+------+
Run Code Online (Sandbox Code Playgroud)
现在,当我发布id值时,我有2行具有相同的Id,然后我需要获取数据并在我的视图页面中显示.为此,我需要相应地在表中添加行.
我的控制器功能
<?php
class Admin_billing extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->model('billing_model');
}
public function getdetails()
{
$data_to_search=$_POST['val'];
$details=array();
$details['description']=$this->billing_model->get_service_name($data_to_search);
$details['type']=$this->billing_model->get_service_name($data_to_search);
$details['price']=$this->billing_model->get_service_pricevalue($data_to_search);
echo json_encode($details);
}
}
Run Code Online (Sandbox Code Playgroud)
在这里,我有一个getdetails()有阵列details.在那个详细信息数组中,我有单个数据的键和值,例如它可以保存数据
description=>phone order, type=> iphone, price => $7000.这会填充我的视图页面中的数据.现在,如果我有多行,如何使其工作?
我的模特功能
public function get_service_name($id)
{
$this->db->select('*');
$this->db->from('service');
$this->db->where('id', $id);
$query = $this->db->get();
$result = $query->result_array();
return $result[0]['name'];
}
Run Code Online (Sandbox Code Playgroud)
此函数用于从我的数据库中的服务表中获取名称.
我的视图文件. …
嗨,我在运行时遇到此错误而未在 android 设备中调试我的项目。
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
> Could not resolve all artifacts for configuration ':app:debugCompileClasspath'.
> Failed to transform artifact 'arm64_v8a_debug.jar (io.flutter:arm64_v8a_debug:1.0.0-c8e3b9485386425213e2973126d6f57e7ed83c54)' to match attributes
{artifactType=android-classes, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
> Execution failed for IdentityTransform: C:\Users\Admin\.gradle\caches\modules-2\files-2.1\io.flutter\arm64_v8a_debug\1.0.0-c8e3b9485386425213e2973126d6f57e7ed83c54\d84df37647d9c0eb0da1f86ba05744d618192eb7\arm64_v8a_debug-1.0.0-c8e3b9485386425213e2973126d6f57e7ed83c54.jar.
> Cannot parse result path string:
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full …Run Code Online (Sandbox Code Playgroud) 我正在使用Cordova开发一个跨平台的移动应用程序.我有一个带有表格的HTML页面.add row点击时我有一个按钮向我的表添加一个新行.我需要一个类似iOS的滑动操作才能执行删除操作.我使用touchstartevent来刷我表中的静态行.这工作正常但不是动态创建的表行.怎么做这个滑动动作?
这是我到目前为止的代码:
HTML
<div class="fortable">
<table id="cashreg">
<tr>
<td class="tablecellbackground"><div class="del" id="d1" ><p>Delete</p></div><div id="cells" class="cells"><div class="denom"><p>Start Time</p></div><div class="cnt"><p>Select Item</p></div><div class="tots"><p>Employee</p></div><div class="tots1"><p>Price</p></div></div></td>
</tr>
</table>
<input type="button" class="addmore">
</div>
Run Code Online (Sandbox Code Playgroud)
JavaScript的
要向表中添加行:
$(".addmore").click(function(){
var rows = $("#cashreg tr").length+1;
$("#cashreg").append('<tr><td class="tablecellbackground"><div class="cells"><div class="denom"><p>Start Time</p></div><div class="cnt"><p>Select Item</p></div><div class="tots"><p>Employee</p></div><div class="tots1"><p>Price</p></div><div class="del"><p>Delete</p></div></div></td></tr>');
});
Run Code Online (Sandbox Code Playgroud)
对于类似iOS的滑动:
window.addEventListener('load', function(){
var el = document.getElementsByClassName('cells')[0];
ontouch(el, function(evt, dir, phase, swipetype, distance){
var touchreport = ''
touchreport += '<b>Dir:</b> ' + dir + '<br />'
touchreport += '<b>Phase:</b> …Run Code Online (Sandbox Code Playgroud) 如何在用户开始在颤动中滚动之前使滚动条可见。这是我制作列表的代码
Scrollbar(
child: ListView.separated(
itemBuilder:
(ctx,index){
return ListTile(
isThreeLine: false,
dense: true,
leading: IconButton(
icon: Icon(Icons.location_on),
onPressed: null,
),
title: Text(bList[index].bName),
onTap: ()=>_homescreen(bList[index].bId,bList[index].bName,index),
);
},
separatorBuilder: (context,index) => Divider(color: Colors.black,),
itemCount: bList.length == null ? 0 : bList.length),
)
Run Code Online (Sandbox Code Playgroud)
将列表包装在滚动条内我可以在滚动时看到滚动条。但是是否可以使滚动条始终可见呢?提前致谢。
我正在尝试使用image_picker插件。我可以使用这个插件将图像作为文件获取。我需要将此图像转换为字节并发送到 api。所以我尝试使用 dart:convert 将图像转换为字节字符串。现在,当我解码时,我得到一个Uint8List类型。如何将其转换为文件并在Image.file()中显示。我无法\xe2\x80\x99t 从这里继续。有人可以帮我弄这个吗。
\n\n考虑一下我从 api 响应中得到的已解码字节,我如何将它们转换为在图像小部件中显示
\n\n这是我到目前为止尝试过的代码。
\n\nvar image = await ImagePicker.pickImage(source: ImageSource.camera);\n\n setState(() {\n imageURI = image;\n final bytes = image.readAsBytesSync();\n\n String img64 = base64Encode(bytes);\n print(bytes);\n print(img64);\n\n final decodedBytes = base64Decode(img64);\n print(decodedBytes);\n //consider i am getting this decodedBytes i am getting from a api response, how can i convert them to display in a Image widget \n });\nRun Code Online (Sandbox Code Playgroud)\n\n我使用writeAsBytesSync()收到此错误,
\n\nUnhandled Exception: FileSystemException: Cannot open file, …Run Code Online (Sandbox Code Playgroud)