我有一个 jQuery 数据表,用于在发出 AJAX 请求后显示数据。但是,如果当前用户是管理员,我想向表中添加第三列,以便他们可以删除条目。如何根据条件语句添加第三列?谢谢。
代码:
// Create our AJAX request to get the data
new Ajax.Request( combat_record_link,
{
method: 'get',
evalJSON: 'force',
parameters: {
'md5check': ipb.vars['secure_hash']
},
onSuccess: function(t)
{
if( Object.isUndefined( t.responseJSON ) )
{
alert( "Bad Request" );
}
else if ( t.responseJSON['error'] )
{
alert( t.responseJSON['error'] );
}
else
{
jQuery('#combat_record').dataTable( {
"data": t.responseJSON,
"paging": true,
"ordering": true,
"order": [[ 0, "desc" ]],
"info": false,
"columns": [
{ "title": "Date", "width": "10%", "data": "date"},
{ "title": …Run Code Online (Sandbox Code Playgroud) 我的应用程序工作正常,几分钟后,在编辑应用程序的另一部分后,它开始从我甚至没有工作的视图控制器抛出EXC_BAD_ACCESS错误.我之间唯一可以认为可能影响它的是,我编辑 - > Refractor->转换为Obj-C ARC ...我只是为指定的文件做了它,而不是我的整个项目是混乱.当我相信错误开始发生时,我正在关注本教程... http://sonnyparlin.com/2011/12/pulltorefresh-ios-5-and-arc-tutorial/ 此外,应用程序启动正常,它只是在崩溃时崩溃在tableview中单击一个单元格.任何帮助将不胜感激!
此行发生错误:
self.releaselink = [[sortedArray objectAtIndex:indexPath.row] objectForKey:@"link"];
Run Code Online (Sandbox Code Playgroud)
这是我的代码,其中错误源自:
@implementation PressReleaseViewController
@synthesize releaselink;
UILabel *departmentNamesLabel;
CGRect *departmentNamesFrame;
- (void)viewDidLoad {
// Load path to plist and sort based on "name"
NSString *path = [[NSBundle mainBundle] pathForResource:
@"departments" ofType:@"plist"];
array = [[NSMutableArray alloc] initWithContentsOfFile:path];
NSSortDescriptor *descriptor = [[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES];
sortedArray = [array sortedArrayUsingDescriptors:[NSArray arrayWithObject:descriptor]];
}
// How many sections are in the table
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
// Set how …Run Code Online (Sandbox Code Playgroud) 我开始更频繁地使用故事板,但我遇到了一个问题.通常当您使用UINavigationController推送视图控制器时,您可以通过以下方式执行此操作,并且您可以将数据与其一起传递:
UIViewController *vc = [[UIViewController alloc] init];
vc.link = [self link];
vc.name = [self name];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc]
[nav presentViewController:vc completion:nil animated:YES];
Run Code Online (Sandbox Code Playgroud)
(我做了上面的内存代码,所以它可能不是100%正确).
既然我正在使用storyboard,我自己也没有实例化视图控制器,那么如何用它传递数据呢?谢谢!
storyboard uiviewcontroller uinavigationcontroller pushviewcontroller ios
下面我得到一个语法错误,你的SQL语法有错误; 查看与您的MySQL服务器版本对应的手册,以便在第1行的'call,county,id,location,callcreated,station,units,calltype,lat,lng)VAL'附近使用正确的语法,并且无法找出原因!任何帮助将不胜感激!
<?php
mysql_connect("localhost", "test", "test") or die(mysql_error());
mysql_select_db("firecom") or die(mysql_error());
$data = file_get_contents("http://208.71.205.35/PITS/");//thanks WCCCA!
$pattern = "/id=\"hidXMLID\" value=\"([^\"]+)\"/";//looking for the rnd xml id#
preg_match_all($pattern, $data, $xmlext);
$url = "http://208.71.205.35/PITS/xml/fire_data_" . $xmlext[1][0] . ".xml";//putting together the secret xml url
$xml = simplexml_load_file($url);
foreach ($xml->marker as $element) {
$lat = $element->attributes()->lat;
$lng = $element->attributes()->lng;
$countydirty = $element->AGENCY;// gets agency
$wcccanumberdirty = $element->CALL_NO;
$iddirty = $element->TWO_DIGIT_CALL_NO;// gets call id#
$calldirty = $element->CALL_TYPE_FINAL_D;// gets call type
$locationdirty = $element->LOCATION;// gets location
$callcreateddirty = …Run Code Online (Sandbox Code Playgroud) 我有一个tableview,显示存储在NSObject中的数组中的数据.NSObject中的一个属性是inputtime(currentCall.inputtime),我想根据它对我显示的数据进行排序.我该怎么做呢?谢谢.
这是我的cellForRowAtIndexPath:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
JointCAD *currentCall = [[xmlParser calls] objectAtIndex:indexPath.row];
static NSString *cellidentifier1 = @"cell1";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellidentifier1];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellidentifier1];
}
cell.textLabel.text = currentCall.currentCallType;
cell.detailTextLabel.text = currentCall.location;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}
Run Code Online (Sandbox Code Playgroud) 我有一个表单,在提交表单时输出以下http字符串:
Field109 = E01&Field112 = E05&Field209 =输入+在+信息+这里%21&Field110 = Field111 = Field113 = Field114 = Field115 = Field116 = Field117 = Field118 = Field119 = Field120 = CreatedBy =公共与dateCreated会= 2013年1月17日+ 08%3A43%3A45&ENTRYID = 14 IP = 98.246.50.81&HandshakeKey =
在我处理提交的PHP脚本中,我检查每个Field以查看它是否已设置.问题是,正如您在上面所看到的,如果表单中的字段在提交时为空,它仍然保留在HTTP字符串中,并isset()认为它已设置并进行处理我告诉它.
如何检查该字段是否真的为空?例如Field110,Field111应该为空,但我的PHP脚本认为它们已设置.
if (isset($_GET["Field110"])) {
array_push($apnsarray, "E02");
}
if (isset($_GET["Field111"])) {
array_push($apnsarray, "E03");
}
Run Code Online (Sandbox Code Playgroud) 我有一个数组,我试图访问消息的值.我认为它让我失望,因为它是一个对象内的一个对象数组.以下是我尝试过的和数据结构.
码:
foreach ($result as $value) {
echo "$value[0]->message";
}
Run Code Online (Sandbox Code Playgroud)
阵:
stdClass Object
(
[results] => Array
(
[0] => stdClass Object
(
[message] => 12345
[unit] => test
[createdAt] => 2013-01-21T14:57:26.613Z
[updatedAt] => 2013-01-21T14:57:26.613Z
[objectId] => 0uiYuJcRYY
)
)
)
Run Code Online (Sandbox Code Playgroud) 我的数据库中有一个表,看起来像这样:
member_id name mgroup_others member_group_id
1 Name1 2,3,10 1
2 Name2 4,5,10 1
3 Name3 6,7,10 1
4 Name4 8,9 1
Run Code Online (Sandbox Code Playgroud)
我需要创建一个SELECT语句,选择所有成员WHERE指定的整数在'mgroup_others'逗号列表中.因此,例如,我会写一个SQL语句,它将选择'mgroup_others'包含'10'的所有成员,它将返回成员1,2和3但不返回4,因为10不在该字段中.任何帮助将不胜感激!谢谢.我也是用PHP编写的.
我在 div 容器中有并排的表格,然后是我想在表格下显示的另一个 div 元素。在任何时候,表中的行数都可能多于彼此。如何让“日志”div 始终显示在行数最多的表格下方?
<div id="table_container">
<table border="1" class="table_tpr">
<tr>
<td width="10%">1</td>
<td width="50%">12345678912345678912345679821345678941536321</td>
<td width="20%">2</td>
</tr>
<tr>
<td width="10%">1</td>
<td width="50%">12345678912345678912345679821345678941536321</td>
<td width="20%">2</td>
</tr>
<tr>
<td width="10%">1</td>
<td width="50%">12345678912345678912345679821345678941536321</td>
<td width="20%">2</td>
</tr>
</table>
<table border="1" class="table_loa">
<tr>
<td>1</td>
<td>2</td>
</tr>
</table>
</div>
<br />
<div class="maintitle">Logs</div>
Run Code Online (Sandbox Code Playgroud) ios ×4
php ×4
variables ×3
mysql ×2
ajax ×1
arrays ×1
css ×1
datatables ×1
get ×1
html ×1
html-table ×1
insert ×1
isset ×1
javascript ×1
jquery ×1
loops ×1
nsarray ×1
object ×1
objective-c ×1
select ×1
sorting ×1
sql ×1
storyboard ×1
uitableview ×1
where ×1
xml-parsing ×1