我的模型
<?php
defined ('BASEPATH') OR exit ('No direct script access allowed');
class Agrivest_model extends CI_Model{
public function __construct(){
parent:: __construct();
$this->load->database();
}
public function get_category_tb(){
$this->db->from('category_tb');
$this->db->limit(1);
$query=$this->db->get();
return $query->result();
}
我的控制器
defined ('BASEPATH') OR exit ('No direct script access allowed');
class Agrivest extends CI_Controller {
function __construct(){
parent::__construct();
$this->load->helper('url');
$this->load->model('agrivest_model'); }
public function index(){
$data['category_tb'] = $this->agrivest_model->get_category_tb();
$this->load->view('landing_page', $data); }
我的观看
<?php foreach ($category_tb as $post){?>
<p class="category_description"><?php echo $post->category_description; ?> </p>
答案 0 :(得分:0)
尝试
OnCollectionChanged(New NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset))
Else
Dim preservIdx = diff.ToPreserve?.Select(Function(x) Items.IndexOf(x.Key))?.ToHashSet
ReplaceOrCopy(Me, diff.ToReplaceByIndex, diff.ToPreserve)
For Each idx In diff.GetIndexesToDelete
If diff.PreserveOnDelete AndAlso preservIdx IsNot Nothing AndAlso preservIdx.Contains(idx) Then Continue For
RemoveAt(idx)
Next
'don't use addrange - will cause a reset
diff.ToAdd.ForEach(Sub(x) Add(x))
End If
_lastRefresh = Now
End Sub
Private Sub ReplaceOrCopy(targetCol As IList(Of Object), src As List(Of KeyValuePair(Of Integer, Object)), toPreserve As Dictionary(Of Object, Object))
For Each pair In src
Dim target = targetCol(pair.Key)
'If the target object implements INPC, then we can safely update those properties
'Otherwise, we have to replace, and return the replaced object to the caller to be handled somehow
'(which is why this method returns a Dictionary(Of T,T) -- the key is the original object, and the value is the new object)
If toPreserve IsNot Nothing AndAlso toPreserve.ContainsKey(target) Then
If TypeOf target Is INotifyPropertyChanged Then
CopyObject(pair.Value, target, , , True)
Else
toPreserve(target) = pair.Value
targetCol(pair.Key) = pair.Value
End If
Else
targetCol(pair.Key) = pair.Value
End If
Next
End Sub
Dim _tokenSource As New CancellationTokenSource
Private Function CancelToken() As CancellationToken
_tokenSource.Cancel()
_tokenSource = New CancellationTokenSource
Return _tokenSource.Token
End Function
Sub New(Query As Func(Of IQueryable))
Me.Query = Query
Timer.Start()
End Sub
Sub FireTimer() 'for testing
Timer_Tick(Nothing, Nothing)
End Sub
Private Sub Timer_Tick(sender As Object, e As EventArgs) Handles Timer.Tick
If Control.GetType.Name = "ComboBox" Then
Dim a = 1
End If
If _lastRequest IsNot Nothing AndAlso Now - _lastRequest < TimeSpan.FromSeconds(2) Then Exit Sub
If Now - _lastRefresh.GetValueOrDefault < RefreshSpan Then Exit Sub
If _queryTask?.Status.In(TaskStatus.Running, TaskStatus.WaitingForActivation) Then Exit Sub
If GetLastInputTime() > 60 * 15 Then Exit Sub
Dim sr = False
sr = ShouldRefresh.Invoke
If Control.GetType.Name = "TestPick" Then
Dim a = 1
End If
If Not sr Then Exit Sub
Refresh()
RaiseEvent Refreshed(Me, Nothing)
End Sub
End Class
不要忘记在您的网址中传递参数category_id