I'm trying to override the jquery ui tooltip class so i can apply a custom class. Using knockout to bind to a span in a cell in a row in a table. But the tooltipClass is ignored. Any idea why? Jquery-ui-1.10
<div data-bind="visible:atleastOne">
<table class="mytable">
<thead>
<tr>
<th colspan="1" class="white-back" />
<th class="border-bottom" colspan="5">Orders</th>
</tr>
<tr>
<th class="title-column border-right" />
<th class="value-column">Account</th>
<th class="value-column">Amount</th>
<th class="value-column">Day</th>
<th class="value-column">Percentage</th>
<th class="value-column">Date</th>
</tr>
</thead>
<tbody data-bind="foreach: { data: items, as: 'item' }">
<!-- ko if: $parent.hasMultiple -->
<tr>
<tdborder-right" colspan="5">
<span class="bold" data-bind="text: 'Item ' + item.Code()"></span>
</td>
<td colspan="5"></td>
</tr>
<!-- /ko -->
<!-- ko foreach: { data: item.childen, as: 'child' } -->
<tr style="display: none;">
<td data-bind="attr:{ id: 'tooltip-content-' + item.code() + '-' + child.code() }">
<div data-bind="template: 'data-template', data: $data">
</div>
</td>
</tr>
<!-- ko foreach: { data: child.readOnly.subOrders, as: 'sub' } -->
<tr class="child-row" data-bind="css: { alt: $parentContext.$index() % 2 }">
<td>
<span data-bind="visible: $index() == 0, text: item.readOnly.title, tooltip: {tooltipClass: 'test', show: true, content: '#tooltip-content-' + item.code() + '-' + child.code() }"></span>
</td>
<td>
<span data-bind="text: sub.readOnly.acc"></span>
</td>
<td class="numeric">
<span data-bind="text: sub.readOnly.amount"></span>
</td>
<td>
<span data-bind="text: sub.readOnly.day"></span>
</td>
<td class="numeric">
<span data-bind="text: sub.readOnly.percentage"></span>
</td>
<td>
<span data-bind="text: sub.readOnly.date"></span>
</td>
</tr>
<!-- /ko -->
<!-- /ko -->
</tbody>
</table>
</div>
css
.test
{
background:pink;
}
If I add this to my stylesheet, the style is overridden wherever a tooltip is used as expected.
.ui-tooltip
{
background:blue;
}
However, I need to specify a different style on different tooltips, so this won't work for me.
I tried targeting the table itself but it doesn't work:
.mytable .ui-tooltip
{
background:pink;
}
Related
I have a table that displays a list of uploaded files. If I uploaded a file it needs to be reflected in the table. This is already happening — not, however, in real-time. I need to refresh the page to reflect the data that I need.
I tried refreshing the div in jquery but it is not working:
<div class="mjs-cell">
<div id="stipsData" data-bind="template:{name: 'rehash-customertab-stips-section', data: stipsViewModel}">
</div>
</div>
<div class="mjs-row">
<table class="table table-striped table-bordered">
<tr>
<th>Stip Name</th>
<th>Status</th>
<th>File Name</th>
</tr>
<tbody data-bind="foreach: $data">
<tr class="stips-row">
<td class="hidden stips-id" data-bind="text: StipulationTypeId"></td>
<td class="stips-text">
<a data-bind="text: StipulationType"></a>
</td>
<td class="stips-status">
<span data-bind="text: Status"></span>
</td>
<td class="stips-uploaded-file" data-bind="text: FileName"></td>
</tr>
</tbody>
</table>
</div>
Here is the code that I use for binding:
stipsViewModel = ko.computed(function () {
DealApiControllers.GetStipulations(dealId,
(response) => {
this.stipsViewModel = response.DealStipulationsDTOs;
},
(error) => {
console.error(error);
});
}, this);
For example the table shows Doc1, Doc2. If I upload Doc3 it should be reflected in the list.
I have a questions about how to loop through a html tab 'form' or 'Table Summary'.
The site : Visit https://mobile.uwants.com/forumdisplay.php?fid=631
I have tried below code but no luck
start_urls = ['https://mobile.uwants.com/forumdisplay.php?fid=631'])
def parse(self, response):
resp =response.xpath("//*[//*[#id='mainbody']/tbody/tr/td/div/table[2]/tbody/tr/td[1]/div[2]/form")
for r in resp:
r = response.xpath('//*[contains(#id,"thread_197")]/a/#href').extract_first()
yield response.follow(r,self.parse_items)
The first image is that this is my initial table that i would like the problem to loop through each comments
The second image is that this is one of the sample that i would like to scrap the comment
HTML Code
<form method="post" name="moderate" action="topicadmin.php?action=moderate&fid=631">
<input type="hidden" name="formhash" value="df27712a" />
<table summary="forum_631" cellspacing="0" cellpadding="0">
<thead class="category">
<tr>
<td class="folder"> </td>
<td class="icon"> </td>
<th>標題</th>
<td class="author">作者</td>
<td class="nums">回覆/查看</td>
<td class="lastpost">最後發表</td>
</tr>
</thead>
<tbody>
<tr>
<td class="folder"><img src="https://n2.hk/images/default/folder_common.gif" alt="announcement" /></td>
<td class="icon"> </td>
<th class="tsubject">論壇公告: 開戰準備!全新版區《Gundam Fan Club》開放!</th>
<td class="author">
<cite>mhmimi</cite>
<em>2017-6-9</em>
</td>
<td class="nums">-</td>
<td class="lastpost">-</td>
</tr>
</tbody>
<!-- Text T4 - Modified by Ivan - start-->
<tbody>
<tr>
<td colspan="6" height="35"><!-- Ad space:Uwants_Web_630_T4 --><script src="https://lv.l.networld.hk/lview?loc=_adb_20_10002834&callback=crystal2.addStaticSlot"></script>
</td>
</tr>
</tbody>
<!-- Text T4 - Modified by Ivan - end-->
<tbody id="stickthread_19434311" class="forumdisplay_thread" data-tid="19434311">
<tr>
<td class="folder"><img src="https://n2.hk/images/default/folder_lock.gif" /></td>
<td class="icon">
</td>
<th class="lock">
<label>
<img src="https://n2.hk/images/default/pin_2.gif" alt="分類置頂" />
<!-- By Rex Heat Thread -->
<!-- By Rex Heat Thread -->
</label>
<span id="thread_19434311" class="tsubject"><!-- google_ad_section_start -->請各會員注意,本版新措施(已生效)<!-- google_ad_section_end --></span>
</th>
<td class="author">
<cite>
Yue33695874
</cite>
<em></em>
</td>
<td class="nums">
<strong>0</strong> / <em>41262</em>
</td>
<td class="lastpost">
<em></em>
<cite>by Yue33695874 </cite>
</td>
</tr>
</tbody> <tbody id="stickthread_16031523" class="forumdisplay_thread" data-tid="16031523">
<tr>
<td class="folder"><img src="https://n2.hk/images/default/folder_lock.gif" /></td>
<td class="icon">
</td>
<th class="lock">
<label>
<img src="https://n2.hk/images/default/pin_2.gif" alt="分類置頂" />
<!-- By Rex Heat Thread -->
<!-- By Rex Heat Thread -->
</label>
<span id="thread_16031523" class="tsubject"><!-- google_ad_section_start -->==手機網絡 版版規== 本版嚴禁一切問價及報價, 違者發帖將被移走及不作通知!<!-- google_ad_section_end --></span>
</th>
<td class="author">
<cite>
quimboy1
</cite>
<em></em>
</td>
<td class="nums">
<strong>0</strong> / <em>61033</em>
</td>
<td class="lastpost">
<em></em>
<cite>by quimboy1 </cite>
</td>
</tr>
</tbody> <tbody id="stickthread_16776292" class="forumdisplay_thread" data-tid="16776292">
<tr>
<td class="folder"><img src="https://n2.hk/images/default/folder_lock.gif" /></td>
<td class="icon">
</td>
<th class="lock">
<label>
<img src="https://n2.hk/images/default/pin_1.gif" alt="本版置頂" />
<!-- By Rex Heat Thread -->
<!-- By Rex Heat Thread -->
</label>
<span id="thread_16776292" class="tsubject"><!-- google_ad_section_start -->溫馨提示 : 小心網上流動手提電話公司sales, 已經有騙案個案及已轉交警方處理<!-- google_ad_section_end --></span>
</th>
<td class="author">
<cite>
chungsm
</cite>
<em></em>
</td>
<td class="nums">
<strong>2</strong> / <em>65809</em>
</td>
<td class="lastpost">
<em></em>
<cite>by chungsm </cite>
</td>
</tr>
</tbody><!--
</table>
<table summary="forum_631" id="forum_631" cellspacing="0" cellpadding="0">
-->
手機網絡 - 熱門話題
</td></tr></tbody-->
<!--td class="folder" colspan="2"> </td-->
<td class="folder" ><img src="https://n2.hk/images/r09/hot_u.gif" /></td>
<td class="icon"> </td>
<th class="" >
<label>
<!-- By Rex Heat Thread -->
<!-- By Rex Heat Thread -->
</label>
<span id="thread_ht_1_19782731" class="tsubject">問 : 中國移動4.5G 網絡 地鐵接收如何</span>
New
Thanks for help guys
Try to change this line:
r = response.xpath('//*[contains(#id,"thread_197")]/a/#href').extract_first()
With this:
r = r.xpath('//*[contains(#id,"thread_197")]/a/#href').extract_first()
I think this is what you meant to do!
If you want to fetch all href contained in the table, you can do:
response.css('.tsubject a::attr(href)').extract()
I have tried with this.
<th style="width:500px;overflow:hidden;">
If I have a large description It is going outside the table & I want to fix it.
<div class="Tablecontent">
<div class="table-responsive">
<div style="min-height:300px">
<table class="table table-hover" >
<thead class="tableHeadDesign">
<tr>
<th style="width:40px; overflow:hidden;">S.No.</th>
<th>Name</th>
<th style="max-width:500px;overflow:hidden;">
Description
</th>
<th>Size </th>
<th>Status </th>
<th></th>
</tr>
</thead>
<tbody class="tableBodyDesign">
<tr ng-repeat="x in media |filter:searchText">
<td>$index </td>
<td>{{x.Name}}</td>
<td>{{ x.Description }}</td>
<td > </td>
<td>{{x.Status}}</td>
<td>
<input type="button" class="btn btn-info btn-lg popbtn ViewBtn" value="View Detail"></a></input>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
Here I want to fix Description Column.
You can use text ellipsis
see this example
td{
max-width:20px;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
table{
width:100%
}
<div class="Tablecontent">
<div class="table-responsive">
<div style="min-height:300px">
<table class="table table-hover" >
<thead class="tableHeadDesign">
<tr>
<th style="width:40px; overflow:hidden;">S.No.</th>
<th>Name</th>
<th style="max-width:500px;overflow:hidden;">
Description
</th>
<th>Size </th>
<th>Status </th>
<th></th>
</tr>
</thead>
<tbody class="tableBodyDesign">
<tr ng-repeat="x in media |filter:searchText">
<td>1 </td>
<td>name</td>
<td>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</td>
<td >dsdsdsdsds </td>
<td>Status</td>
<td>
<input type="button" class="btn btn-info btn-lg popbtn ViewBtn" value="View Detail"></a></input>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
Are you looking for text-overflow?
<td style="max-width:500px; display:inline-block; overflow:hidden; text-overflow:clip; white-space:nowrap;">
{{ x.Description }}
</td>
Here is an example:
https://jsfiddle.net/59166290/aan0s31t/15/embedded/result/
Problem solve...
Actually I had fixed the and forgot to set the fixed size of :p
I have a Bootstrap issue where my table disappears. When my page displays more than 1200 pixels wide my table shows perfectly. But when my page is shrunk to less than 1200 pixels wide my table disappears. I am not super advanced with bootstrap(not a design guy) so i am unsure what is causing the problem. I think it has something to do do with responsive tables. Also I have not edited my bootstrap.
<div class="row">
<div class="col-md-12">
<div class="panel panel-cascade">
<!-- heading-->
<div class="panel-heading text-primary">
<h3 class="panel-title">
Friends List
<span class="pull-right">
<i class="fa fa-chevron-up"></i>
<i class="fa fa-times"></i>
</span>
</h3>
</div>
<!-- body -->
<div class="panel-body">
<table class="table table-condensed table-hover">
<thead>
<tr>
<th class="visible-lg">First Name</th>
<th class="visible-lg">Last Name</th>
<th class="visible-lg">Phone Number</th>
<th class="visible-lg">Carrier</th>
<th class="visible-lg">Send Text</th>
</tr>
</thead>
<tbody>
#foreach (var row in Model)
{
<tr>
<td class="visible-lg">
#row.FirstName
</td>
<td class="visible-lg">
#row.LastName
</td>
<td class="visible-lg">
#row.PhoneNumber###row.Carriers[0].CarrierEmail
</td>
<td class="visible-lg">
#row.Carriers[0].CarrierName
</td>
<td class="visible-lg">
#using (Html.BeginForm("SendEmail", "Admin"))
{
#Html.Hidden("Id", row.Id)
<button type="submit" class="btn btn-success"><i class="fa fa-envelope"></i></button>
}
</td>
</tr>
}
</tbody>
</table>
</div>
</div>
</div>
</div>
I think it is because of class you are using "visible-lg", wich means visible when large, bootstrap 3 uses 4 different sizes xs, sm, md, lg. take a read at this article http://getbootstrap.com/css/.
I use this classes in my tables and they work perfect.
<table id="proviers-table" class="table table-striped table-bordered">
<thead>
<tr>
<th>Nombre</th>
<th>Teléfono</th>
<th>Correo Electrónico</th>
<th>País</th>
<th>Entidad Federativa</th>
<th>Dirección</th>
<th></th>
</tr>
</thead>
<tr>
<td>coty</td>
<td>1234567890</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>
<div class="btn-group">
<button class="btn btn-default btn-xs edit-provider" id="1" >
<span class="glyphicon glyphicon-pencil"></span>
</button>
<button class="btn btn-default btn-xs edit-provider" id="1">
<span class="glyphicon glyphicon-trash"></span>
</button>
</div>
</td>
</tr>
<tr>
</table>
here is my view:
when small:
I have a asp.net mvc2 page where I display data with titles and descriptions using knockout. I want to hide descriptions and show description based on clicked title. any help would be appreciated. Also I would like to apply h1 tag to title.
<div id="dataDiv">
<table style="text-align: left" border="0">
<tbody>
<!-- ko foreach: list -->
<tr>
<td colspan="2" data-bind="text: title">
</td>
</tr>
<tr>
<td colspan="2" data-bind="text: description">
</td>
</tr>
<tr>
<td colspan="2">
<hr style="border-top: 1px dotted #f00; color: #fff; background-color: #fff; height: 1px;
width: 100%;" />
</td>
</tr>
<!-- /ko -->
</tbody>
</table>
Is this is what You are looking for?
Working demo http://jsfiddle.net/Rgxy9/
HTML:
<table style="text-align: left" border="0">
<tbody data-bind="foreach: list">
<tr>
<td colspan="2" data-bind="click: $root.select">
<h1 data-bind="text: title" />
</td>
</tr>
<tr data-bind="visible: $root.selected() == $data">
<td colspan="2" data-bind="text: description">
</td>
</tr>
<tr>
<td colspan="2">
<hr style="border-top: 1px dotted #f00; color: #fff; background-color: #fff; height: 1px;
width: 100%;" />
</td>
</tr>
</tbody>
</table>
<script type="text/javascript">
var item = function(title, desc) {
this.title = ko.observable(title);
this.description = ko.observable(desc);
};
var vm = function() {
var self = this;
this.list = ko.observableArray([new item('some', 'desc'),
new item('som2', 'desc2')]);
this.selected = ko.observable();
this.select = function(item) {
self.selected(item);
};
};
ko.applyBindings(new vm());
</script>