Что возращаюсь еще раз к теме об использовании в представлении Jquery ui/
Собственно проблема вот в чем. Один и тот же код (внутри представления и отдельным файлом). Дает разное отображение.
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" type="text/css" href="/dev/js/jquery-ui-1.10.4.custom/css/jquery-ui-1.10.4.custom.min.css"/>
<link rel="stylesheet" type="text/css" href="/dev/main.css"/>
<script src="//code.jquery.com/jquery-1.9.1.js"></script>
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<script type="text/javascript">
$(function() {
//диалог редактирование записи
$("div#edit_dialog").dialog({
autoOpen: true,
modal: true,
dragable: true,
resizable: true,
width: 600,
height: 400,
buttons: {
OK: function () {
var type = $("div#status_b input:radio:checked").prop("id");
//айди строки
var id_tr = $("input#tr_id_status").val();
//примечания
var tips = $("textarea#tips_w").text();
var csrf = $("input#csrf").val();
//куплено - 1, не куплено - 0, частично куплено - значение из поля
var count_w = -1;
switch (type) {
case 'radio2':
//не куплено
count_w = 0;
break;
case 'radio3':
count_w = $("input#count_w").val();
break;
}
$.ajax({
type: 'POST',
url: 'report.php',
data: {id: 71, id_tr: id_tr, action: 'update_tr', type: type, count_w: count_w, tips: tips, csrf: csrf},
success: function (data) {
//в случае успешного запроса закрываем окно
}
});
$(this).dialog('close');
},
CLOSE: function () {
$(this).dialog('close');
//нечего не делаем
}
}
});
//вешаем обработчик на радиобаттоны
$("div#status_b input:radio[name=radio]").click(function (event) {
//получаем айди выбранного баттона
var id_p = $(this).attr("id");
//Если товар куплен частично
if (id_p == 'radio3') {
$("#count_buy").show();
} else {
//Скрываем поле количество
$("#count_buy").hide();
}
});
//утсанавливаем радиобаттоны в форме редактирования
$("div#status_b").buttonset();
$("#count_buy").hide();
});
</script>
</head>
<body>
<div id="edit_dialog">
<table align="center">
<tr>
<td>
<form>
<div id="status_b">
<input type="radio" id="radio1" name="radio" checked="checked"><label
for="radio1">Куплено</label>
<input type="radio" id="radio2" name="radio"><label for="radio2">Не куплено</label>
<input type="radio" id="radio3" name="radio"><label for="radio3">Куплено не полностью</label>
</div>
</form>
</td>
</tr>
<tr id="count_buy">
<td><label>Количество: <input type="text" id="count_w" value="fff"></label></td>
</tr>
<tr>
<td>
Примечание:
</td>
</tr>
<tr>
<td><textarea id="tips_w" rows="5" cols="50" name="text"></textarea></td>
</tr>
</table>
<input type=hidden name="tr_id_status" id="tr_id_status">
<input type="hidden" name="csrf" id="csrf" value="{$csrf}">
</div>
</body>
</html>
В итоге все получается красиво. Смотреть
здесь
В атаче скрин того что получилось из представления. При том что код 1 в 1. Причина? Как исправить?
Прикрепленные изображения
Сообщение отредактировал wondertalik: 12 Февраль 2014 - 10:50