我需要自动换行以在空格上备用文本,例如:
这是我的 文本
现在它不像
这是我的意思 分机
我的代码是
<style>
#grid {word-wrap: break-word ;}
#grid {white-space: pre-wrap ;}
</style>
<table id="grid"></table>
表格由jQuery填充了一些随机文本,但我认为它现在不重要。
完整代码:
<style>
A {
color: #000;
}
html, body {
height: 95%;
}
#grid {word-wrap: break-word ;}
#grid {white-space: pre-wrap ;}
jQuery(document).ready(function () {
infoName = '@Model.infoName';
$('#grid').jqGrid({
hidegrid: false,
url: "/Home/GetInfo/" + @Model.infoIdOut, page: 1,
datatype: 'json',
jsonReader: {
repeatitems: false
},
mtype: 'GET',
afterInsertRow: function (rowid, aData) {
},
colNames: ['infoid', infoName],
colModel: [
{ name: 'infoId', index: 'infoId', hidden: true, sortable: false },
{ name: 'infoText', align: 'left', sortable: false, hidden: false}
],
height: '100%',
rowNum: 1,
viewrecords: true,
subGridOptions: {
openicon: "ui-helper-hidden"
},
loadComplete: function () {
gridId = ("grid");
gridWidth = $('#gbox_' + gridId).parent().width();
gridHeight = $(window).innerHeight();
$('#' + gridId).jqGrid('setGridWidth', gridWidth);
$('#' + gridId).jqGrid('setGridHeight', gridHeight);
gridId = "tree";
gridHeight = $(window).innerHeight();
$('#' + gridId).jqGrid('setGridHeight', gridHeight);
}
});
$('#tree').jqGrid({
url: '/Home/infoTree/',
mtype: 'GET',
treeGrid: true,
treeGridModel: 'adjacency',
ExpandColumn: 'infoName',
ExpandColClick: true,
treedatatype: 'json',
datatype: 'json',
colNames: ['infoId', 'infoName'],
colModel: [
{ name: 'infoId', index: 'infoId', hidden: true, sortable: false },
{ name: 'infoName', index: 'infoName', hidden: false, sortable: false }
],
onSelectRow: function (ids) {
if (ids != null) {
data = jQuery('#tree').getRowData(ids);
jQuery("#grid").setGridParam({ url: "/Home/GetInfo/" + ids })
.trigger('reloadGrid');
}
},
caption: ''
});
$("#grid").jqGrid("hideCol", "subgrid");
gridId = "grid";
gridWidth = $('#gbox_' + gridId).parent().width();
$('#' + gridId).jqGrid('setGridWidth', gridWidth);
gridHeight = $(window).innerHeight();
$('#' + gridId).jqGrid('setGridHeight', gridHeight);
gridId = "tree";
gridWidth = $('#gbox_' + gridId).parent().width();
$('#' + gridId).jqGrid('setGridWidth', gridWidth);
gridHeight = $(window).innerHeight();
$('#' + gridId).jqGrid('setGridHeight', gridHeight);
$('#' + gridId).closest("div.ui-jqgrid-view")
.children("div.ui-jqgrid-hdiv")
.hide();
<div class="span3" style="font-size: 12.0pt">
<div class="specialtree" style="height:100%; width: 100%">
<table id="tree" style="height:100%; width: 100%"></table>
</div>
<div class="row-fluid">
<div class="span9">
<table id="grid" style="height:100%; width: 100%"></table>
</div></div>