使用ngGrid v2.X,我试图在页面滚动(不是网格滚动)到底时开发一个加载更多数据的网格.
通过搜索类似的问题,我找到了第一个问题的解决方案: ngGrid必须有动态高度,所以我做了这个
.ngViewport{ height:auto !important; } .ngCanvas, .ngViewport, .ngRow, .ngFooterPanel, .ngTopPanel { width: 100% !important; } .ngRow { border-bottom:none !important; }
Run Code Online (Sandbox Code Playgroud)
这让我想到了第二个问题.我需要通过滚动加载数据,我发现:ngGridEventScroll,但是当使用ngGrid实习生滚动时,我只需触发,我需要页面滚动
$scope.$on('ngGridEventScroll', function () {
$scope.currentDataPosition++;
$scope.setPagingData($scope.dataArray, $scope.currentDataPosition, $scope.pagingOptions.pageSize);
});
Run Code Online (Sandbox Code Playgroud)
因此,解决方案1打破了解决方案2,因为ngGridEventScroll不再具有实习生滚动.
$scope.setPagingData = function (data, page, pageSize) {
cfpLoadingBar.start();
var pagedData = data.slice((page - 1) * pageSize, page * pageSize, page * pageSize);
$scope.totalServerItems = data.length;
$scope.myData = pagedData;
cfpLoadingBar.complete();
};
$scope.gridOptions = {
data: 'myData',
virtualizationThreshold: 50,
enableRowSelection: …Run Code Online (Sandbox Code Playgroud) 当用户执行搜索时,应保存这些搜索设置以备将来使用。
用户应填写一些表单字段,然后执行搜索。当他执行新的搜索时,旧的应该可以,等等。
我使用 javascript,jQuery。
我怎么能这样做?
我的意思是将它保存在本地机器中,而不是保存在数据库中。
我已经检查了类似的问题,但它在我的确切问题中没有帮助.
所以,我的表是这样的:
id age
1 30
2 36
3 30
4 52
5 52
6 30
7 36
Run Code Online (Sandbox Code Playgroud)
等等..
我需要计算年龄的频率:
age freq
30 2
36 3
52 2
Run Code Online (Sandbox Code Playgroud)
我怎么能抓住这个频率?在此之后,我将需要使用该数据,因此可能需要使用数组?谢谢!
function drawChart() {
// Create the data table.
var data = new google.visualization.DataTable();
data.addColumn('string', 'age');
data.addColumn('number', 'freq');
<?php
while($row = mysql_fetch_row($result))
{
$frequencies[$row[0]] = $frequencies[1];
echo "data.addRow(['{$row[0]}', {$row[1]}]);";
}
?>
Run Code Online (Sandbox Code Playgroud)
目标是建立一个图表
$SQLString = "SELECT
count(score) as counts,
DATE(date),
SUM(CASE WHEN gender = 1 then 1 ELSE 0 END) Male,
SUM(CASE WHEN gender = 2 then 1 ELSE 0 END) Female,
AVG(age) as age, score
FROM persons
WHERE date > '".$_SESSION['date1']."' AND date < '".$_SESSION['date2']."'
GROUP BY DATE(date)
ORDER BY DATE(date) asc";
Run Code Online (Sandbox Code Playgroud)
这是我的查询,每天显示一些数据,如性别、年龄等。如何按月或年汇总这些日期并显示添加的数据?
如果我不解释我自己,请注意我:)
我想做的事:
index.html - >表单提交到some.php - >进程数据(来自index.html)并将数据发送到server.php - >将结果返回到index.html div.
我读过ajax,jQuery,我在这个网站上看到了数百个问题,但我还是想不通.
index.html的:
<form action="some.php" method="post">
Start date: <br/> <input name="idate" id="firstdate" type="text" /><br />
End date: <br /> <input name="fdate" id="seconddate" type="text" /><br />
<br />
<input type="button" id="searchForm" onclick="SubmitForm();" value="Send" />
</form>
Run Code Online (Sandbox Code Playgroud)
some.php:
<?php
session_start();
$_SESSION['data1'] = $_POST['firstdate'];
$_SESSION['data2'] = $_POST['seconddate'];
?>
function drawChart() {
var jsonData = $.ajax({
url: "server.php",
dataType: "json",
async: false
}).responseText;
var obj = jQuery.parseJSON(jsonData);
var data = google.visualization.arrayToDataTable(obj);
(...)
Run Code Online (Sandbox Code Playgroud)
server.php: …
我需要找到并单击ng-repeater的最后一个元素(byID).
我的输出应该是这样的:(例如数据)
myArray = [ [otherArray0], [otherArray1], [otherArrayN] ]
Run Code Online (Sandbox Code Playgroud)
我的尝试:
var myArray = [];
var num = 50;
for (i=0; i<num;i++)
{
var a = 0;
$('#divID .class select[value!=""]').each(function() //get values from a select
{
var otherArray+i = []; //each for cycle is a new "sub array"
otherArray+i[a] = $(this).val(); //store in array the values from select
a++
})
}
Run Code Online (Sandbox Code Playgroud)
我在想什么?
我怎样才能做到这一点 ?这不起作用,没有结果,没有效果,没有错误输出.
$('input[type=checkbox]').each(function()
{
if($(this).attr("checked") === true){
$('.hoverbox .a').css('text-transform', 'uppercase');
}
else
{
$('.hoverbox .a').css('text-transform', 'lowercase');
}
});
Run Code Online (Sandbox Code Playgroud)