小编sci*_*ket的帖子

jquery - 禁用单击

我只想禁用用户在某些条件下单击元素的功能.以下是我正在使用的一些代码:

     $('#navigation a').bind('click',function(e){

    var $this   = $(this);
    var prev    = current;

    current = $this.parent().index() + 1; // store the position in current

    if (current == 1){
    $("#navigation a:eq(1)").unbind("click"); // i want to disable the ability to click this element if current is 1
    }
    if (current >= 2){
    $("#navigation a:eq(1)").bind("click"); // this is wrong, but I want to rebind the click if current is greater than 1.  
    }
Run Code Online (Sandbox Code Playgroud)

}

javascript jquery

44
推荐指数
4
解决办法
19万
查看次数

DataTable load()约束错误

我在下面编写了一个方法,使用反射在.NET应用程序中加载几个强类型的数据表.如果我按原样运行,一切正常 - 包括没有抛出异常.但是如果我使用注释部分(保持其他所有内容相同),那么我将无法启用此处描述的约束错误:在此处输入链接描述.

如果我查看errors数组中的内容,它总是如下:

"Column 'AEDelegateName' does not allow DBNull.Value."
Run Code Online (Sandbox Code Playgroud)

并且错误的ItemArray将类似于:

[0] = {}
[1] = "Some Value"
Run Code Online (Sandbox Code Playgroud)

这让我感到惊讶,因为我只希望脚本中的一列选择1列,而不是像上面所示的2列.我也想象这很接近问题,因为其中一个似乎是空的.

我的脚本不会返回null,我可以快速直观地确认它,并在我使用的查询中说出NOT NULL之类的内容.

private void GetData(string query, Component tableAdapter)
{
    OracleCommand command = new OracleCommand();
    command.Connection = conn;
    command.CommandText = query;
    command.CommandType = CommandType.Text;
    command.CommandTimeout = 3000;
    OracleDataReader reader = command.ExecuteReader(CommandBehavior.SingleResult);
    MethodInfo[] methods = tableAdapter.GetType().GetMethods();
    MethodInfo getDataMethod = tableAdapter.GetType().GetMethod("GetData");
    DataTable table = (DataTable)getDataMethod.Invoke(tableAdapter, null);
    Type[] paramTypes = new Type[] { table.GetType() };
    MethodInfo updateMethod …
Run Code Online (Sandbox Code Playgroud)

.net c# database oracle datatable

6
推荐指数
1
解决办法
3179
查看次数

Excel工作簿激活C#VSTO的事件歧义

这是错误:

Error   2   Cannot assign to 'Activate' because it is a 'method group'  
Warning 1   Ambiguity between method 'Microsoft.Office.Interop.Excel._Workbook.Activate()' and non-method 'Microsoft.Office.Interop.Excel.WorkbookEvents_Event.Activate'. Using method group.
Run Code Online (Sandbox Code Playgroud)

我可以用

myWorkbook.Deactivate += new Excel.WorkbookEvents_DeactivateEventHandler(ThisWorkbook_Deactivate);
Run Code Online (Sandbox Code Playgroud)

因为没有工作簿的deactivate()方法.有一个Activate()方法,我不想使用它.我想要像这样处理工作簿激活事件,但我得到上面的错误

myWorkbook.Activate += new Excel.WorkbookEvents_ActivateEventHandler(ThisWorkbook_Activate);
Run Code Online (Sandbox Code Playgroud)

有什么想法吗?

excel vsto

3
推荐指数
1
解决办法
3001
查看次数

将帖子加载到div中

实际上,我想这样说:

$('#results1').html($.post("videoloaderurl.php", { id: byName } ));
Run Code Online (Sandbox Code Playgroud)

显然,上面的代码不起作用.其中results1是div,videoloaderurl.php返回html.

php jquery post

2
推荐指数
1
解决办法
130
查看次数

Google Chart HTML Tooltip 显示 html 文本

我在选项中指定了 HTML 工具栏,但它仍然在工具提示中呈现 HTML 文本,而不是 HTML 的结果。我该如何解决这个问题,以便它呈现 HTML 结果?

我创建了一个数据视图并像这样设置列:

projectView.setColumns([0,1,3,{
    type:'string',
    role:'tooltip',
    calc:function(dt,row){
        var date = dt.getFormattedValue(row,0);
        var totalErrors = dt.getFormattedValue(row,3);
        var percent = Math.round((dt.getValue(row,3)/dt.getValue(row,1))*100);  
        return '<div><b>'+ date +'</b><br><b>Error Percent: </b>' + percent + '<br><b>Total Errors: </b>' + totalErrors + '</div>';
    }
}]);
Run Code Online (Sandbox Code Playgroud)

选项是这样的:

var options = {
    width:850,
    height:375,
    chartArea: {width: '70%', height: '70%',left: 40,top:25},
    hAxis:{format:'MM/dd/yy'},
    vAxis:{logScale:false},         
    series:{0:{type:'line'},1:{type:'area'}},
    tooltip: { isHtml: true }};
Run Code Online (Sandbox Code Playgroud)

然后我绘制图表:

var projectChart = new google.visualization.ComboChart(document.getElementById('project_chart_div'));
projectChart.draw(projectView, options);
Run Code Online (Sandbox Code Playgroud)

html charts dataview tooltip google-visualization

2
推荐指数
1
解决办法
2413
查看次数